2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
/**
|
|
|
|
|
* @defgroup Skins Skins
|
|
|
|
|
*/
|
|
|
|
|
|
2006-01-07 12:31:39 +00:00
|
|
|
if ( ! defined( 'MEDIAWIKI' ) )
|
2006-06-07 06:40:24 +00:00
|
|
|
die( 1 );
|
2004-08-12 06:54:58 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
2006-02-18 04:34:10 +00:00
|
|
|
* The main skin class that provide methods and properties for all other skins.
|
2004-09-02 23:28:24 +00:00
|
|
|
* This base class is also the "Standard" skin.
|
2007-04-24 06:53:31 +00:00
|
|
|
*
|
|
|
|
|
* See docs/skin.txt for more information.
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup Skins
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2004-12-18 06:29:23 +00:00
|
|
|
class Skin extends Linker {
|
2004-09-02 23:28:24 +00:00
|
|
|
/**#@+
|
2006-04-19 15:46:24 +00:00
|
|
|
* @private
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2006-12-26 23:53:34 +00:00
|
|
|
var $mWatchLinkNum = 0; // Appended to end of watch link id's
|
2008-04-22 22:35:50 +00:00
|
|
|
// How many search boxes have we made? Avoid duplicate id's.
|
|
|
|
|
protected $searchboxes = '';
|
2004-09-02 23:28:24 +00:00
|
|
|
/**#@-*/
|
2007-05-03 06:08:12 +00:00
|
|
|
protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
|
2009-03-29 12:46:11 +00:00
|
|
|
protected $skinname = 'standard';
|
2009-04-20 19:01:12 +00:00
|
|
|
// @fixme Should be protected :-\
|
|
|
|
|
var $mTitle = null;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-03-03 17:17:03 +00:00
|
|
|
/** Constructor, call parent constructor */
|
2007-01-20 13:34:31 +00:00
|
|
|
function Skin() { parent::__construct(); }
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-12-19 23:36:43 +00:00
|
|
|
/**
|
|
|
|
|
* Fetch the set of available skins.
|
|
|
|
|
* @return array of strings
|
|
|
|
|
* @static
|
|
|
|
|
*/
|
2007-01-22 23:50:42 +00:00
|
|
|
static function getSkinNames() {
|
2006-06-08 15:12:26 +00:00
|
|
|
global $wgValidSkinNames;
|
2006-07-02 15:57:59 +00:00
|
|
|
static $skinsInitialised = false;
|
|
|
|
|
if ( !$skinsInitialised ) {
|
|
|
|
|
# Get a list of available skins
|
|
|
|
|
# Build using the regular expression '^(.*).php$'
|
|
|
|
|
# Array keys are all lower case, array value keep the case used by filename
|
|
|
|
|
#
|
|
|
|
|
wfProfileIn( __METHOD__ . '-init' );
|
|
|
|
|
global $wgStyleDirectory;
|
|
|
|
|
$skinDir = dir( $wgStyleDirectory );
|
|
|
|
|
|
|
|
|
|
# while code from www.php.net
|
2009-03-29 12:46:11 +00:00
|
|
|
while( false !== ( $file = $skinDir->read() ) ) {
|
2006-07-02 15:57:59 +00:00
|
|
|
// Skip non-PHP files, hidden files, and '.dep' includes
|
2006-11-29 11:43:58 +00:00
|
|
|
$matches = array();
|
2009-03-29 12:46:11 +00:00
|
|
|
if( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) {
|
2006-07-02 15:57:59 +00:00
|
|
|
$aSkin = $matches[1];
|
|
|
|
|
$wgValidSkinNames[strtolower($aSkin)] = $aSkin;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$skinDir->close();
|
|
|
|
|
$skinsInitialised = true;
|
|
|
|
|
wfProfileOut( __METHOD__ . '-init' );
|
|
|
|
|
}
|
2006-06-08 15:12:26 +00:00
|
|
|
return $wgValidSkinNames;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2008-08-06 17:41:17 +00:00
|
|
|
/**
|
|
|
|
|
* Fetch the list of usable skins in regards to $wgSkipSkins.
|
|
|
|
|
* Useful for Special:Preferences and other places where you
|
|
|
|
|
* only want to show skins users _can_ use.
|
|
|
|
|
* @return array of strings
|
|
|
|
|
*/
|
|
|
|
|
public static function getUsableSkins() {
|
|
|
|
|
global $wgSkipSkins;
|
|
|
|
|
$usableSkins = self::getSkinNames();
|
|
|
|
|
foreach ( $wgSkipSkins as $skip ) {
|
|
|
|
|
unset( $usableSkins[$skip] );
|
|
|
|
|
}
|
|
|
|
|
return $usableSkins;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-19 23:36:43 +00:00
|
|
|
/**
|
|
|
|
|
* Normalize a skin preference value to a form that can be loaded.
|
|
|
|
|
* If a skin can't be found, it will fall back to the configured
|
|
|
|
|
* default (or the old 'Classic' skin if that's broken).
|
|
|
|
|
* @param string $key
|
|
|
|
|
* @return string
|
|
|
|
|
* @static
|
|
|
|
|
*/
|
2006-07-10 15:41:30 +00:00
|
|
|
static function normalizeKey( $key ) {
|
2005-12-19 23:36:43 +00:00
|
|
|
global $wgDefaultSkin;
|
2006-11-08 07:12:03 +00:00
|
|
|
$skinNames = Skin::getSkinNames();
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-19 23:36:43 +00:00
|
|
|
if( $key == '' ) {
|
|
|
|
|
// Don't return the default immediately;
|
|
|
|
|
// in a misconfiguration we need to fall back.
|
|
|
|
|
$key = $wgDefaultSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( isset( $skinNames[$key] ) ) {
|
|
|
|
|
return $key;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-19 23:36:43 +00:00
|
|
|
// Older versions of the software used a numeric setting
|
|
|
|
|
// in the user preferences.
|
|
|
|
|
$fallback = array(
|
|
|
|
|
0 => $wgDefaultSkin,
|
|
|
|
|
1 => 'nostalgia',
|
|
|
|
|
2 => 'cologneblue' );
|
|
|
|
|
|
|
|
|
|
if( isset( $fallback[$key] ) ){
|
|
|
|
|
$key = $fallback[$key];
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-19 23:36:43 +00:00
|
|
|
if( isset( $skinNames[$key] ) ) {
|
|
|
|
|
return $key;
|
|
|
|
|
} else {
|
2007-12-14 06:53:15 +00:00
|
|
|
return 'monobook';
|
2005-12-19 23:36:43 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-19 23:36:43 +00:00
|
|
|
/**
|
|
|
|
|
* Factory method for loading a skin of a given type
|
|
|
|
|
* @param string $key 'monobook', 'standard', etc
|
|
|
|
|
* @return Skin
|
|
|
|
|
* @static
|
|
|
|
|
*/
|
2006-07-10 15:41:30 +00:00
|
|
|
static function &newFromKey( $key ) {
|
2008-12-10 23:39:02 +00:00
|
|
|
global $wgStyleDirectory;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-11-08 07:12:03 +00:00
|
|
|
$key = Skin::normalizeKey( $key );
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2006-11-08 07:12:03 +00:00
|
|
|
$skinNames = Skin::getSkinNames();
|
2005-12-19 23:36:43 +00:00
|
|
|
$skinName = $skinNames[$key];
|
2007-12-14 06:53:15 +00:00
|
|
|
$className = 'Skin'.ucfirst($key);
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2006-02-18 04:34:10 +00:00
|
|
|
# Grab the skin class and initialise it.
|
2008-12-10 23:39:02 +00:00
|
|
|
if ( !class_exists( $className ) ) {
|
2007-12-14 06:53:15 +00:00
|
|
|
// Preload base classes to work around APC/PHP5 bug
|
|
|
|
|
$deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
|
|
|
|
|
if( file_exists( $deps ) ) include_once( $deps );
|
|
|
|
|
require_once( "{$wgStyleDirectory}/{$skinName}.php" );
|
|
|
|
|
|
|
|
|
|
# Check if we got if not failback to default skin
|
|
|
|
|
if( !class_exists( $className ) ) {
|
|
|
|
|
# DO NOT die if the class isn't found. This breaks maintenance
|
|
|
|
|
# scripts and can cause a user account to be unrecoverable
|
|
|
|
|
# except by SQL manipulation if a previously valid skin name
|
|
|
|
|
# is no longer valid.
|
|
|
|
|
wfDebug( "Skin class does not exist: $className\n" );
|
|
|
|
|
$className = 'SkinMonobook';
|
2007-12-14 19:14:12 +00:00
|
|
|
require_once( "{$wgStyleDirectory}/MonoBook.php" );
|
2007-12-14 06:53:15 +00:00
|
|
|
}
|
2005-12-19 23:36:43 +00:00
|
|
|
}
|
2006-07-11 14:11:23 +00:00
|
|
|
$skin = new $className;
|
2005-12-19 23:36:43 +00:00
|
|
|
return $skin;
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-03-03 17:17:03 +00:00
|
|
|
/** @return string path to the skin stylesheet */
|
2005-12-19 23:36:43 +00:00
|
|
|
function getStylesheet() {
|
2006-10-13 21:48:19 +00:00
|
|
|
return 'common/wikistandard.css';
|
2005-12-19 23:36:43 +00:00
|
|
|
}
|
2004-09-03 21:22:20 +00:00
|
|
|
|
2005-03-03 17:17:03 +00:00
|
|
|
/** @return string skin name */
|
2007-04-16 13:23:16 +00:00
|
|
|
public function getSkinName() {
|
|
|
|
|
return $this->skinname;
|
2004-06-09 13:04:52 +00:00
|
|
|
}
|
2004-07-24 13:18:14 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function qbSetting() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgOut, $wgUser;
|
|
|
|
|
|
2004-02-26 13:37:26 +00:00
|
|
|
if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
|
2006-12-14 20:28:38 +00:00
|
|
|
$q = $wgUser->getOption( 'quickbar', 0 );
|
2003-04-14 23:10:40 +00:00
|
|
|
return $q;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
function initPage( OutputPage $out ) {
|
2008-08-04 17:30:01 +00:00
|
|
|
global $wgFavicon, $wgAppleTouchIcon;
|
2006-02-03 04:04:05 +00:00
|
|
|
|
2007-10-13 11:24:50 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2009-07-27 23:42:58 +00:00
|
|
|
# Add favicons and Apple touch icons, if they're not the defaults
|
|
|
|
|
#
|
2008-10-15 21:51:21 +00:00
|
|
|
# Generally the order of the favicon and apple-touch-icon links
|
|
|
|
|
# should not matter, but Konqueror (3.5.9 at least) incorrectly
|
|
|
|
|
# uses whichever one appears later in the HTML source. Make sure
|
|
|
|
|
# apple-touch-icon is specified first to avoid this.
|
2009-07-27 23:42:58 +00:00
|
|
|
if( false !== $wgAppleTouchIcon && wfExpandUrl('/apple-touch-icon.png') != wfExpandUrl($wgAppleTouchIcon) ) {
|
2008-01-19 05:39:41 +00:00
|
|
|
$out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
|
2008-04-14 07:45:50 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2009-07-27 23:42:58 +00:00
|
|
|
if( false !== $wgFavicon && wfExpandUrl('/favicon.ico') != wfExpandUrl($wgFavicon) ) {
|
2008-10-15 21:51:21 +00:00
|
|
|
$out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
|
|
|
|
|
}
|
|
|
|
|
|
2006-08-20 03:45:47 +00:00
|
|
|
# OpenSearch description link
|
2008-04-14 07:45:50 +00:00
|
|
|
$out->addLink( array(
|
|
|
|
|
'rel' => 'search',
|
2006-08-20 03:45:47 +00:00
|
|
|
'type' => 'application/opensearchdescription+xml',
|
2008-08-04 17:30:01 +00:00
|
|
|
'href' => wfScript( 'opensearch_desc' ),
|
2008-03-02 21:19:44 +00:00
|
|
|
'title' => wfMsgForContent( 'opensearch-desc' ),
|
2006-08-20 03:45:47 +00:00
|
|
|
));
|
|
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
$this->addMetadataLinks( $out );
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-01 09:47:44 +00:00
|
|
|
$this->mRevisionId = $out->mRevisionId;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-03-16 02:47:49 +00:00
|
|
|
$this->preloadExistence();
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2007-10-13 11:24:50 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-03-16 02:47:49 +00:00
|
|
|
/**
|
|
|
|
|
* Preload the existence of three commonly-requested pages in a single query
|
|
|
|
|
*/
|
|
|
|
|
function preloadExistence() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgUser;
|
2006-03-16 02:47:49 +00:00
|
|
|
|
2007-01-22 19:19:15 +00:00
|
|
|
// User/talk link
|
|
|
|
|
$titles = array( $wgUser->getUserPage(), $wgUser->getTalkPage() );
|
|
|
|
|
|
|
|
|
|
// Other tab link
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
|
2007-01-22 19:19:15 +00:00
|
|
|
// nothing
|
2009-04-09 02:22:36 +00:00
|
|
|
} elseif ( $this->mTitle->isTalkPage() ) {
|
|
|
|
|
$titles[] = $this->mTitle->getSubjectPage();
|
2006-03-16 02:47:49 +00:00
|
|
|
} else {
|
2009-04-09 02:22:36 +00:00
|
|
|
$titles[] = $this->mTitle->getTalkPage();
|
2006-03-16 02:47:49 +00:00
|
|
|
}
|
2007-01-22 19:19:15 +00:00
|
|
|
|
|
|
|
|
$lb = new LinkBatch( $titles );
|
2006-03-16 02:47:49 +00:00
|
|
|
$lb->execute();
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
function addMetadataLinks( OutputPage $out ) {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
|
2005-12-04 18:27:59 +00:00
|
|
|
global $wgRightsPage, $wgRightsUrl;
|
2004-04-10 11:19:33 +00:00
|
|
|
|
|
|
|
|
if( $out->isArticleRelated() ) {
|
|
|
|
|
# note: buggy CC software only reads first "meta" link
|
|
|
|
|
if( $wgEnableCreativeCommonsRdf ) {
|
|
|
|
|
$out->addMetadataLink( array(
|
|
|
|
|
'title' => 'Creative Commons',
|
|
|
|
|
'type' => 'application/rdf+xml',
|
2009-04-09 02:22:36 +00:00
|
|
|
'href' => $this->mTitle->getLocalURL( 'action=creativecommons' ) )
|
2009-03-29 12:46:11 +00:00
|
|
|
);
|
2004-04-10 11:19:33 +00:00
|
|
|
}
|
|
|
|
|
if( $wgEnableDublinCoreRdf ) {
|
|
|
|
|
$out->addMetadataLink( array(
|
|
|
|
|
'title' => 'Dublin Core',
|
|
|
|
|
'type' => 'application/rdf+xml',
|
2009-04-09 02:22:36 +00:00
|
|
|
'href' => $this->mTitle->getLocalURL( 'action=dublincore' ) )
|
2009-03-29 12:46:11 +00:00
|
|
|
);
|
2004-04-10 11:19:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2004-06-09 01:18:04 +00:00
|
|
|
$copyright = '';
|
2004-04-10 11:19:33 +00:00
|
|
|
if( $wgRightsPage ) {
|
|
|
|
|
$copy = Title::newFromText( $wgRightsPage );
|
|
|
|
|
if( $copy ) {
|
|
|
|
|
$copyright = $copy->getLocalURL();
|
|
|
|
|
}
|
2004-04-04 21:58:05 +00:00
|
|
|
}
|
2004-04-10 11:19:33 +00:00
|
|
|
if( !$copyright && $wgRightsUrl ) {
|
|
|
|
|
$copyright = $wgRightsUrl;
|
|
|
|
|
}
|
|
|
|
|
if( $copyright ) {
|
|
|
|
|
$out->addLink( array(
|
2004-06-09 01:18:04 +00:00
|
|
|
'rel' => 'copyright',
|
2009-03-29 12:46:11 +00:00
|
|
|
'href' => $copyright )
|
|
|
|
|
);
|
2004-04-04 21:58:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2009-04-15 04:43:06 +00:00
|
|
|
/**
|
2009-04-15 23:38:23 +00:00
|
|
|
* Set some local variables
|
2009-04-15 04:43:06 +00:00
|
|
|
*/
|
|
|
|
|
protected function setMembers(){
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgUser;
|
2008-08-21 14:09:57 +00:00
|
|
|
$this->mUser = $wgUser;
|
|
|
|
|
$this->userpage = $wgUser->getUserPage()->getPrefixedText();
|
|
|
|
|
$this->usercss = false;
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2009-04-15 04:43:06 +00:00
|
|
|
/**
|
|
|
|
|
* Set the title
|
|
|
|
|
* @param Title $t The title to use
|
|
|
|
|
*/
|
|
|
|
|
public function setTitle( $t ) {
|
|
|
|
|
$this->mTitle = $t;
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2009-04-20 14:32:41 +00:00
|
|
|
/** Get the title */
|
|
|
|
|
public function getTitle() {
|
|
|
|
|
return $this->mTitle;
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
function outputPage( OutputPage $out ) {
|
|
|
|
|
global $wgDebugComments;
|
2007-03-08 01:40:56 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
2008-08-21 14:09:57 +00:00
|
|
|
|
|
|
|
|
$this->setMembers();
|
2004-01-17 05:49:39 +00:00
|
|
|
$this->initPage( $out );
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2008-08-11 13:41:52 +00:00
|
|
|
// See self::afterContentHook() for documentation
|
2008-08-11 13:47:10 +00:00
|
|
|
$afterContent = $this->afterContentHook();
|
2008-08-11 13:41:52 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
$out->out( $out->headElement( $this ) );
|
2003-09-11 12:21:03 +00:00
|
|
|
|
|
|
|
|
$out->out( "\n<body" );
|
|
|
|
|
$ops = $this->getBodyOptions();
|
|
|
|
|
foreach ( $ops as $name => $val ) {
|
|
|
|
|
$out->out( " $name='$val'" );
|
|
|
|
|
}
|
|
|
|
|
$out->out( ">\n" );
|
|
|
|
|
if ( $wgDebugComments ) {
|
|
|
|
|
$out->out( "<!-- Wiki debugging output:\n" .
|
|
|
|
|
$out->mDebugtext . "-->\n" );
|
|
|
|
|
}
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2003-09-11 12:21:03 +00:00
|
|
|
$out->out( $this->beforeContent() );
|
|
|
|
|
|
2004-04-03 10:01:08 +00:00
|
|
|
$out->out( $out->mBodytext . "\n" );
|
2003-09-11 12:21:03 +00:00
|
|
|
|
|
|
|
|
$out->out( $this->afterContent() );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2008-08-11 13:47:10 +00:00
|
|
|
$out->out( $afterContent );
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-07-29 22:34:22 +00:00
|
|
|
$out->out( $this->bottomScripts() );
|
|
|
|
|
|
2008-04-16 20:51:13 +00:00
|
|
|
$out->out( wfReportTime() );
|
2003-09-11 12:21:03 +00:00
|
|
|
|
|
|
|
|
$out->out( "\n</body></html>" );
|
2007-03-08 01:40:56 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
2003-09-11 12:21:03 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2006-12-08 06:09:15 +00:00
|
|
|
static function makeVariablesScript( $data ) {
|
2009-08-11 00:09:24 +00:00
|
|
|
$r = array();
|
2006-12-08 06:09:15 +00:00
|
|
|
foreach ( $data as $name => $value ) {
|
|
|
|
|
$encValue = Xml::encodeJsVar( $value );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$r[] = "var $name = $encValue;";
|
2006-12-08 06:09:15 +00:00
|
|
|
}
|
2009-08-11 00:09:24 +00:00
|
|
|
return Html::inlineScript( "\n\t\t" . implode( "\n\t\t", $r ) .
|
|
|
|
|
"\n\t\t" );
|
2006-07-28 22:52:46 +00:00
|
|
|
}
|
|
|
|
|
|
2006-12-08 06:09:15 +00:00
|
|
|
/**
|
|
|
|
|
* Make a <script> tag containing global variables
|
2009-07-08 04:38:01 +00:00
|
|
|
* @param $skinName string Name of the skin
|
2006-12-08 06:09:15 +00:00
|
|
|
* The odd calling convention is for backwards compatibility
|
2009-04-09 02:22:36 +00:00
|
|
|
* @TODO @FIXME Make this not depend on $wgTitle!
|
2006-12-08 06:09:15 +00:00
|
|
|
*/
|
2009-07-08 04:38:01 +00:00
|
|
|
static function makeGlobalVariablesScript( $skinName ) {
|
|
|
|
|
if ( is_array( $skinName ) ) {
|
|
|
|
|
# Weird back-compat stuff.
|
|
|
|
|
$skinName = $skinName['skinname'];
|
|
|
|
|
}
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgScript, $wgTitle, $wgStylePath, $wgUser;
|
2009-05-30 19:49:51 +00:00
|
|
|
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang, $wgVariant;
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
|
2008-02-25 16:38:25 +00:00
|
|
|
global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths;
|
2007-07-05 13:57:54 +00:00
|
|
|
global $wgUseAjax, $wgAjaxWatch;
|
2008-01-14 18:42:39 +00:00
|
|
|
global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI;
|
2008-03-04 21:27:23 +00:00
|
|
|
global $wgRestrictionTypes, $wgLivePreview;
|
2008-04-15 23:06:28 +00:00
|
|
|
global $wgMWSuggestTemplate, $wgDBname, $wgEnableMWSuggest;
|
2006-07-28 19:05:27 +00:00
|
|
|
|
2006-11-29 05:45:03 +00:00
|
|
|
$ns = $wgTitle->getNamespace();
|
|
|
|
|
$nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
|
2008-10-28 08:07:00 +00:00
|
|
|
$separatorTransTable = $wgContLang->separatorTransformTable();
|
|
|
|
|
$separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
|
|
|
|
|
$compactSeparatorTransTable = array(
|
|
|
|
|
implode( "\t", array_keys( $separatorTransTable ) ),
|
|
|
|
|
implode( "\t", $separatorTransTable ),
|
|
|
|
|
);
|
|
|
|
|
$digitTransTable = $wgContLang->digitTransformTable();
|
|
|
|
|
$digitTransTable = $digitTransTable ? $digitTransTable : array();
|
|
|
|
|
$compactDigitTransTable = array(
|
|
|
|
|
implode( "\t", array_keys( $digitTransTable ) ),
|
|
|
|
|
implode( "\t", $digitTransTable ),
|
|
|
|
|
);
|
2007-06-04 10:09:41 +00:00
|
|
|
|
2009-08-04 19:17:31 +00:00
|
|
|
$mainPage = Title::newFromText( wfMsgForContent( 'mainpage' ) );
|
2008-04-14 07:45:50 +00:00
|
|
|
$vars = array(
|
2009-07-08 04:38:01 +00:00
|
|
|
'skin' => $skinName,
|
2006-07-28 22:52:46 +00:00
|
|
|
'stylepath' => $wgStylePath,
|
2006-12-08 06:09:15 +00:00
|
|
|
'wgArticlePath' => $wgArticlePath,
|
|
|
|
|
'wgScriptPath' => $wgScriptPath,
|
2007-06-28 15:13:28 +00:00
|
|
|
'wgScript' => $wgScript,
|
2008-02-25 16:38:25 +00:00
|
|
|
'wgVariantArticlePath' => $wgVariantArticlePath,
|
2008-08-21 14:09:57 +00:00
|
|
|
'wgActionPaths' => (object)$wgActionPaths,
|
2006-12-08 06:09:15 +00:00
|
|
|
'wgServer' => $wgServer,
|
|
|
|
|
'wgCanonicalNamespace' => $nsname,
|
2008-01-14 09:13:04 +00:00
|
|
|
'wgCanonicalSpecialPageName' => SpecialPage::resolveAlias( $wgTitle->getDBkey() ),
|
2006-12-08 06:09:15 +00:00
|
|
|
'wgNamespaceNumber' => $wgTitle->getNamespace(),
|
|
|
|
|
'wgPageName' => $wgTitle->getPrefixedDBKey(),
|
|
|
|
|
'wgTitle' => $wgTitle->getText(),
|
2007-03-27 21:15:23 +00:00
|
|
|
'wgAction' => $wgRequest->getText( 'action', 'view' ),
|
2006-12-08 06:09:15 +00:00
|
|
|
'wgArticleId' => $wgTitle->getArticleId(),
|
|
|
|
|
'wgIsArticle' => $wgOut->isArticle(),
|
|
|
|
|
'wgUserName' => $wgUser->isAnon() ? NULL : $wgUser->getName(),
|
2007-01-23 20:10:02 +00:00
|
|
|
'wgUserGroups' => $wgUser->isAnon() ? NULL : $wgUser->getEffectiveGroups(),
|
2009-05-30 19:49:51 +00:00
|
|
|
'wgUserVariant' => $wgVariant->getCode(),
|
2006-12-08 06:09:15 +00:00
|
|
|
'wgUserLanguage' => $wgLang->getCode(),
|
|
|
|
|
'wgContentLanguage' => $wgContLang->getCode(),
|
|
|
|
|
'wgBreakFrames' => $wgBreakFrames,
|
|
|
|
|
'wgCurRevisionId' => isset( $wgArticle ) ? $wgArticle->getLatest() : 0,
|
2008-01-14 18:42:39 +00:00
|
|
|
'wgVersion' => $wgVersion,
|
|
|
|
|
'wgEnableAPI' => $wgEnableAPI,
|
|
|
|
|
'wgEnableWriteAPI' => $wgEnableWriteAPI,
|
2008-10-28 08:07:00 +00:00
|
|
|
'wgSeparatorTransformTable' => $compactSeparatorTransTable,
|
|
|
|
|
'wgDigitTransformTable' => $compactDigitTransTable,
|
2009-08-04 19:17:31 +00:00
|
|
|
'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null,
|
2006-07-28 22:52:46 +00:00
|
|
|
);
|
2009-05-30 19:49:51 +00:00
|
|
|
if ( !( $wgContLang->hasVariants() ) ) {
|
|
|
|
|
unset( $vars['wgUserVariant'] );
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
|
|
|
|
//if on upload page output the extension list & js_upload
|
|
|
|
|
if( SpecialPage::resolveAlias( $wgTitle->getDBkey() ) == "Upload" ){
|
|
|
|
|
global $wgFileExtensions, $wgAjaxUploadInterface;
|
|
|
|
|
$vars['wgFileExtensions'] = $wgFileExtensions;
|
|
|
|
|
$vars['wgAjaxUploadInterface'] = $wgAjaxUploadInterface;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ){
|
2008-04-15 23:06:28 +00:00
|
|
|
$vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate();
|
|
|
|
|
$vars['wgDBname'] = $wgDBname;
|
|
|
|
|
$vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $wgUser );
|
2009-03-29 12:46:11 +00:00
|
|
|
$vars['wgMWSuggestMessages'] = array( wfMsg( 'search-mwsuggest-enabled' ), wfMsg( 'search-mwsuggest-disabled' ) );
|
2008-04-15 23:06:28 +00:00
|
|
|
}
|
2006-07-28 22:52:46 +00:00
|
|
|
|
2008-03-04 21:27:23 +00:00
|
|
|
foreach( $wgRestrictionTypes as $type )
|
|
|
|
|
$vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type );
|
|
|
|
|
|
2007-02-09 20:34:57 +00:00
|
|
|
if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
|
|
|
|
|
$vars['wgLivepreviewMessageLoading'] = wfMsg( 'livepreview-loading' );
|
|
|
|
|
$vars['wgLivepreviewMessageReady'] = wfMsg( 'livepreview-ready' );
|
|
|
|
|
$vars['wgLivepreviewMessageFailed'] = wfMsg( 'livepreview-failed' );
|
|
|
|
|
$vars['wgLivepreviewMessageError'] = wfMsg( 'livepreview-error' );
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-10 20:05:57 +00:00
|
|
|
if ( $wgOut->isArticleRelated() && $wgUseAjax && $wgAjaxWatch && $wgUser->isLoggedIn() ) {
|
2007-07-05 13:57:54 +00:00
|
|
|
$msgs = (object)array();
|
|
|
|
|
foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching' ) as $msgName ) {
|
|
|
|
|
$msgs->{$msgName . 'Msg'} = wfMsg( $msgName );
|
|
|
|
|
}
|
|
|
|
|
$vars['wgAjaxWatch'] = $msgs;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
// Allow extensions to add their custom variables to the global JS variables
|
|
|
|
|
wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) );
|
2008-08-01 22:38:11 +00:00
|
|
|
|
2006-12-08 06:09:15 +00:00
|
|
|
return self::makeVariablesScript( $vars );
|
|
|
|
|
}
|
2009-07-07 21:49:45 +00:00
|
|
|
/**
|
2009-07-18 14:24:24 +00:00
|
|
|
* Return a random selection of the scripts we want in the header,
|
|
|
|
|
* according to no particular rhyme or reason. Various other scripts are
|
|
|
|
|
* returned from a haphazard assortment of other functions scattered over
|
|
|
|
|
* various files. This entire hackish system needs to be burned to the
|
|
|
|
|
* ground and rebuilt.
|
2009-07-07 21:49:45 +00:00
|
|
|
*
|
2009-07-18 14:24:24 +00:00
|
|
|
* @param $out OutputPage object, should be $wgOut
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
*
|
|
|
|
|
* @return string Raw HTML to output to <head>
|
2009-07-07 21:49:45 +00:00
|
|
|
*/
|
2009-07-18 14:24:24 +00:00
|
|
|
function getHeadScripts( OutputPage $out ) {
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
global $wgStylePath, $wgUser, $wgJsMimeType, $wgStyleVersion, $wgOut;
|
|
|
|
|
global $wgUseSiteJs;
|
2006-12-08 06:09:15 +00:00
|
|
|
|
2009-07-18 14:24:24 +00:00
|
|
|
$vars = self::makeGlobalVariablesScript( $this->getSkinName() );
|
2006-09-22 13:07:06 +00:00
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
//moved wikibits to be called earlier on
|
|
|
|
|
//$out->addScriptFile( "{$wgStylePath}/common/wikibits.js" );
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgUseSiteJs ) {
|
2007-07-09 21:39:42 +00:00
|
|
|
$jsCache = $wgUser->isLoggedIn() ? '&smaxage=0' : '';
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$wgOut->addScriptFile( self::makeUrl( '-',
|
2007-07-09 21:39:42 +00:00
|
|
|
"action=raw$jsCache&gen=js&useskin=" .
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
urlencode( $this->getSkinName() )
|
|
|
|
|
)
|
|
|
|
|
);
|
2006-11-17 02:05:34 +00:00
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
if( $out->isUserJsAllowed() && $wgUser->isLoggedIn() ) {
|
2005-02-21 12:23:52 +00:00
|
|
|
$userpage = $wgUser->getUserPage();
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$userjs = self::makeUrl(
|
2005-02-21 12:23:52 +00:00
|
|
|
$userpage->getPrefixedText().'/'.$this->getSkinName().'.js',
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
'action=raw&ctype='.$wgJsMimeType );
|
|
|
|
|
$wgOut->addScriptFile( $userjs );
|
2004-06-09 13:04:52 +00:00
|
|
|
}
|
2009-07-18 14:24:24 +00:00
|
|
|
return "\t" . $vars . "\t" . $out->mScripts;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2005-02-04 06:19:37 +00:00
|
|
|
/**
|
|
|
|
|
* To make it harder for someone to slip a user a fake
|
|
|
|
|
* user-JavaScript or user-CSS preview, a random token
|
|
|
|
|
* is associated with the login session. If it's not
|
|
|
|
|
* passed back with the preview request, we won't render
|
|
|
|
|
* the code.
|
|
|
|
|
*
|
|
|
|
|
* @param string $action
|
|
|
|
|
* @return bool
|
2006-04-19 15:46:24 +00:00
|
|
|
* @private
|
2005-02-04 06:19:37 +00:00
|
|
|
*/
|
|
|
|
|
function userCanPreview( $action ) {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgRequest, $wgUser;
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2005-02-04 06:19:37 +00:00
|
|
|
if( $action != 'submit' )
|
|
|
|
|
return false;
|
|
|
|
|
if( !$wgRequest->wasPosted() )
|
|
|
|
|
return false;
|
2009-08-01 16:44:44 +00:00
|
|
|
if( !$this->mTitle->userCanEditCssSubpage() )
|
|
|
|
|
return false;
|
|
|
|
|
if( !$this->mTitle->userCanEditJsSubpage() )
|
2005-02-04 06:19:37 +00:00
|
|
|
return false;
|
|
|
|
|
return $wgUser->matchEditToken(
|
|
|
|
|
$wgRequest->getVal( 'wpEditToken' ) );
|
|
|
|
|
}
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2008-08-10 07:14:08 +00:00
|
|
|
/**
|
2008-08-21 14:09:57 +00:00
|
|
|
* generated JavaScript action=raw&gen=js
|
|
|
|
|
* This returns MediaWiki:Common.js and MediaWiki:[Skinname].js concate-
|
|
|
|
|
* nated together. For some bizarre reason, it does *not* return any
|
|
|
|
|
* custom user JS from subpages. Huh?
|
|
|
|
|
*
|
|
|
|
|
* There's absolutely no reason to have separate Monobook/Common JSes.
|
|
|
|
|
* Any JS that cares can just check the skin variable generated at the
|
|
|
|
|
* top. For now Monobook.js will be maintained, but it should be consi-
|
|
|
|
|
* dered deprecated.
|
2006-11-17 02:05:34 +00:00
|
|
|
*
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
* @param force_skin lets you override the skin name
|
|
|
|
|
*
|
2008-08-21 14:09:57 +00:00
|
|
|
* @return string
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
public function generateUserJs( $skinName = null) {
|
2008-08-21 14:09:57 +00:00
|
|
|
global $wgStylePath;
|
|
|
|
|
|
2006-12-26 23:53:34 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
if(!$skinName){
|
|
|
|
|
$skinName = $this->getSkinName();
|
|
|
|
|
}
|
2006-11-17 02:05:34 +00:00
|
|
|
|
|
|
|
|
$s = "/* generated javascript */\n";
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$s .= "var skin = '" . Xml::escapeJsString($skinName ) . "';\n";
|
2007-07-09 21:39:42 +00:00
|
|
|
$s .= "var stylepath = '" . Xml::escapeJsString( $wgStylePath ) . "';";
|
2006-11-17 02:05:34 +00:00
|
|
|
$s .= "\n\n/* MediaWiki:Common.js */\n";
|
2009-03-29 12:46:11 +00:00
|
|
|
$commonJs = wfMsgForContent( 'common.js' );
|
|
|
|
|
if ( !wfEmptyMsg( 'common.js', $commonJs ) ) {
|
2006-11-17 02:05:34 +00:00
|
|
|
$s .= $commonJs;
|
|
|
|
|
}
|
2008-08-21 14:09:57 +00:00
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$s .= "\n\n/* MediaWiki:".ucfirst( $skinName ).".js */\n";
|
2008-08-21 14:09:57 +00:00
|
|
|
// avoid inclusion of non defined user JavaScript (with custom skins only)
|
|
|
|
|
// by checking for default message content
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$msgKey = ucfirst( $skinName ).'.js';
|
2009-03-29 12:46:11 +00:00
|
|
|
$userJS = wfMsgForContent( $msgKey );
|
2008-08-21 14:09:57 +00:00
|
|
|
if ( !wfEmptyMsg( $msgKey, $userJS ) ) {
|
|
|
|
|
$s .= $userJS;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-26 23:53:34 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
2006-11-17 02:05:34 +00:00
|
|
|
return $s;
|
2007-04-21 14:44:56 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-08-10 07:14:08 +00:00
|
|
|
/**
|
2009-03-29 12:46:11 +00:00
|
|
|
* Generate user stylesheet for action=raw&gen=css
|
2008-08-10 07:14:08 +00:00
|
|
|
*/
|
2008-08-21 14:09:57 +00:00
|
|
|
public function generateUserStylesheet() {
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
$s = "/* generated user stylesheet */\n" .
|
|
|
|
|
$this->reallyGenerateUserStylesheet();
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
2008-08-10 07:14:08 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
2008-08-21 14:09:57 +00:00
|
|
|
* Split for easier subclassing in SkinSimple, SkinStandard and SkinCologneBlue
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2008-08-21 14:09:57 +00:00
|
|
|
protected function reallyGenerateUserStylesheet(){
|
2005-03-25 07:25:49 +00:00
|
|
|
global $wgUser;
|
|
|
|
|
$s = '';
|
2009-03-29 12:46:11 +00:00
|
|
|
if( ( $undopt = $wgUser->getOption( 'underline' ) ) < 2 ) {
|
2005-07-05 19:33:44 +00:00
|
|
|
$underline = $undopt ? 'underline' : 'none';
|
2007-01-06 23:19:33 +00:00
|
|
|
$s .= "a { text-decoration: $underline; }\n";
|
2005-07-05 19:33:44 +00:00
|
|
|
}
|
2005-03-25 07:25:49 +00:00
|
|
|
if( $wgUser->getOption( 'highlightbroken' ) ) {
|
2003-07-07 01:34:43 +00:00
|
|
|
$s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
|
2005-03-25 07:25:49 +00:00
|
|
|
} else {
|
|
|
|
|
$s .= <<<END
|
|
|
|
|
a.new, #quickbar a.new,
|
|
|
|
|
a.stub, #quickbar a.stub {
|
|
|
|
|
color: inherit;
|
|
|
|
|
}
|
|
|
|
|
a.new:after, #quickbar a.new:after {
|
|
|
|
|
content: "?";
|
|
|
|
|
color: #CC2200;
|
|
|
|
|
}
|
|
|
|
|
a.stub:after, #quickbar a.stub:after {
|
|
|
|
|
content: "!";
|
|
|
|
|
color: #772233;
|
|
|
|
|
}
|
|
|
|
|
END;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2005-03-25 07:25:49 +00:00
|
|
|
if( $wgUser->getOption( 'justify' ) ) {
|
2008-04-29 20:48:17 +00:00
|
|
|
$s .= "#article, #bodyContent, #mw_content { text-align: justify; }\n";
|
2005-03-25 09:35:59 +00:00
|
|
|
}
|
|
|
|
|
if( !$wgUser->getOption( 'showtoc' ) ) {
|
|
|
|
|
$s .= "#toc { display: none; }\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2005-07-05 19:15:13 +00:00
|
|
|
if( !$wgUser->getOption( 'editsection' ) ) {
|
|
|
|
|
$s .= ".editsection { display: none; }\n";
|
|
|
|
|
}
|
2009-07-28 15:37:59 +00:00
|
|
|
$fontstyle = $wgUser->getOption( 'editfont' );
|
|
|
|
|
if ( $fontstyle !== 'default' ) {
|
|
|
|
|
$s .= "textarea { font-family: $fontstyle; }\n";
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
2008-06-19 18:18:57 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
/**
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
function setupUserCss( OutputPage $out ) {
|
|
|
|
|
global $wgRequest, $wgContLang, $wgUser;
|
|
|
|
|
global $wgAllowUserCss, $wgUseSiteCss, $wgSquidMaxage, $wgStylePath;
|
|
|
|
|
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
|
|
|
|
|
$this->setupSkinUserCss( $out );
|
|
|
|
|
|
|
|
|
|
$siteargs = array(
|
|
|
|
|
'action' => 'raw',
|
|
|
|
|
'maxage' => $wgSquidMaxage,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Add any extension CSS
|
2009-08-11 00:09:24 +00:00
|
|
|
foreach ( $out->getExtStyle() as $url ) {
|
|
|
|
|
$out->addStyle( $url );
|
2008-08-21 14:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we use the site's dynamic CSS, throw that in, too
|
|
|
|
|
// Per-site custom styles
|
|
|
|
|
if( $wgUseSiteCss ) {
|
2008-09-04 03:13:55 +00:00
|
|
|
global $wgHandheldStyle;
|
2008-08-21 14:09:57 +00:00
|
|
|
$query = wfArrayToCGI( array(
|
|
|
|
|
'usemsgcache' => 'yes',
|
|
|
|
|
'ctype' => 'text/css',
|
|
|
|
|
'smaxage' => $wgSquidMaxage
|
|
|
|
|
) + $siteargs );
|
|
|
|
|
# Site settings must override extension css! (bug 15025)
|
2008-09-10 12:12:59 +00:00
|
|
|
$out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) );
|
|
|
|
|
$out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI ), 'print' );
|
2008-09-04 03:13:55 +00:00
|
|
|
if( $wgHandheldStyle ) {
|
2008-09-10 12:12:59 +00:00
|
|
|
$out->addStyle( self::makeNSUrl( 'Handheld.css', $query, NS_MEDIAWIKI ), 'handheld' );
|
2008-09-04 03:13:55 +00:00
|
|
|
}
|
2008-08-21 14:09:57 +00:00
|
|
|
$out->addStyle( self::makeNSUrl( $this->getSkinName() . '.css', $query, NS_MEDIAWIKI ) );
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-10 12:12:59 +00:00
|
|
|
if( $wgUser->isLoggedIn() ) {
|
|
|
|
|
// Ensure that logged-in users' generated CSS isn't clobbered
|
|
|
|
|
// by anons' publicly cacheable generated CSS.
|
|
|
|
|
$siteargs['smaxage'] = '0';
|
|
|
|
|
$siteargs['ts'] = $wgUser->mTouched;
|
|
|
|
|
}
|
2008-08-21 14:09:57 +00:00
|
|
|
// Per-user styles based on preferences
|
|
|
|
|
$siteargs['gen'] = 'css';
|
|
|
|
|
if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) {
|
|
|
|
|
$siteargs['useskin'] = $us;
|
|
|
|
|
}
|
|
|
|
|
$out->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) );
|
|
|
|
|
|
|
|
|
|
// Per-user custom style pages
|
|
|
|
|
if( $wgAllowUserCss && $wgUser->isLoggedIn() ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
$action = $wgRequest->getVal( 'action' );
|
2008-08-21 14:09:57 +00:00
|
|
|
# If we're previewing the CSS page, use it
|
|
|
|
|
if( $this->mTitle->isCssSubpage() && $this->userCanPreview( $action ) ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
$previewCss = $wgRequest->getText( 'wpTextbox1' );
|
2008-08-21 14:09:57 +00:00
|
|
|
// @FIXME: properly escape the cdata!
|
|
|
|
|
$this->usercss = "/*<![CDATA[*/\n" . $previewCss . "/*]]>*/";
|
|
|
|
|
} else {
|
2009-03-29 12:46:11 +00:00
|
|
|
$out->addStyle( self::makeUrl( $this->userpage . '/' . $this->getSkinName() .'.css',
|
2008-09-10 12:12:59 +00:00
|
|
|
'action=raw&ctype=text/css' ) );
|
2008-08-21 14:09:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add skin specific stylesheets
|
|
|
|
|
* @param $out OutputPage
|
|
|
|
|
*/
|
|
|
|
|
function setupSkinUserCss( OutputPage $out ) {
|
|
|
|
|
$out->addStyle( 'common/shared.css' );
|
|
|
|
|
$out->addStyle( 'common/oldshared.css' );
|
|
|
|
|
$out->addStyle( $this->getStylesheet() );
|
|
|
|
|
$out->addStyle( 'common/common_rtl.css', '', '', 'rtl' );
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
function getBodyOptions() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgUser, $wgOut, $wgRequest, $wgContLang;
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-05-13 14:17:44 +00:00
|
|
|
extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( 0 != $this->mTitle->getNamespace() ) {
|
2004-06-09 01:18:04 +00:00
|
|
|
$a = array( 'bgcolor' => '#ffffec' );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-06-09 01:18:04 +00:00
|
|
|
else $a = array( 'bgcolor' => '#FFFFFF' );
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgOut->isArticle() && $wgUser->getOption( 'editondblclick' ) &&
|
2009-04-09 02:22:36 +00:00
|
|
|
$this->mTitle->quickUserCan( 'edit' ) ) {
|
|
|
|
|
$s = $this->mTitle->getFullURL( $this->editUrlOptions() );
|
2008-12-14 19:14:21 +00:00
|
|
|
$s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
|
2009-03-29 12:46:11 +00:00
|
|
|
$a += array( 'ondblclick' => $s );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2003-12-10 10:30:14 +00:00
|
|
|
$a['onload'] = $wgOut->getOnloadHandler();
|
2008-03-04 03:22:08 +00:00
|
|
|
$a['class'] =
|
2008-08-10 19:48:30 +00:00
|
|
|
'mediawiki' .
|
2009-08-22 01:24:04 +00:00
|
|
|
' '.( $wgContLang->getDir() ).
|
2009-04-09 02:22:36 +00:00
|
|
|
' '.$this->getPageClasses( $this->mTitle ) .
|
2009-03-29 12:46:11 +00:00
|
|
|
' skin-'. Sanitizer::escapeClass( $this->getSkinName() );
|
2003-04-14 23:10:40 +00:00
|
|
|
return $a;
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2008-08-10 20:10:37 +00:00
|
|
|
function getPageClasses( $title ) {
|
2008-08-10 19:48:30 +00:00
|
|
|
$numeric = 'ns-'.$title->getNamespace();
|
|
|
|
|
if( $title->getNamespace() == NS_SPECIAL ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
$type = 'ns-special';
|
2008-08-10 19:48:30 +00:00
|
|
|
} elseif( $title->isTalkPage() ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
$type = 'ns-talk';
|
2008-08-10 19:48:30 +00:00
|
|
|
} else {
|
2009-03-29 12:46:11 +00:00
|
|
|
$type = 'ns-subject';
|
2008-08-10 19:48:30 +00:00
|
|
|
}
|
2008-08-10 20:10:37 +00:00
|
|
|
$name = Sanitizer::escapeClass( 'page-'.$title->getPrefixedText() );
|
2008-11-13 08:15:23 +00:00
|
|
|
return "$numeric $type $name";
|
2008-08-10 19:48:30 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
* URL to the logo
|
|
|
|
|
*/
|
2004-09-02 00:25:56 +00:00
|
|
|
function getLogo() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgLogo;
|
|
|
|
|
return $wgLogo;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
* This will be called immediately after the <body> tag. Split into
|
|
|
|
|
* two functions to make it easier to subclass.
|
|
|
|
|
*/
|
|
|
|
|
function beforeContent() {
|
2004-07-16 12:12:35 +00:00
|
|
|
return $this->doBeforeContent();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
function doBeforeContent() {
|
2006-05-31 20:39:14 +00:00
|
|
|
global $wgContLang;
|
2009-03-29 12:46:11 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = '';
|
2003-04-14 23:10:40 +00:00
|
|
|
$qb = $this->qbSetting();
|
|
|
|
|
|
|
|
|
|
if( $langlinks = $this->otherLanguages() ) {
|
|
|
|
|
$rows = 2;
|
2004-06-09 01:18:04 +00:00
|
|
|
$borderhack = '';
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
|
|
|
|
$rows = 1;
|
|
|
|
|
$langlinks = false;
|
2004-06-09 01:18:04 +00:00
|
|
|
$borderhack = 'class="top"';
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "\n<div id='content'>\n<div id='topbar'>\n" .
|
|
|
|
|
"<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
$shove = ( $qb != 0 );
|
|
|
|
|
$left = ( $qb == 1 || $qb == 3 );
|
|
|
|
|
if( $wgContLang->isRTL() ) $left = !$left;
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
if( !$shove ) {
|
2004-04-09 10:38:03 +00:00
|
|
|
$s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
|
2004-06-09 01:18:04 +00:00
|
|
|
$this->logoText() . '</td>';
|
2003-07-09 04:57:32 +00:00
|
|
|
} elseif( $left ) {
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= $this->getQuickbarCompensator( $rows );
|
|
|
|
|
}
|
2009-08-22 01:24:04 +00:00
|
|
|
$l = $wgContLang->alignStart();
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "<td {$borderhack} align='$l' valign='top'>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
$s .= $this->topLinks();
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-08-22 01:24:04 +00:00
|
|
|
$r = $wgContLang->alignEnd();
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= $this->nameAndLogin();
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "\n<br />" . $this->searchForm() . "</td>";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
if ( $langlinks ) {
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-09 04:57:32 +00:00
|
|
|
if ( $shove && !$left ) { # Right
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= $this->getQuickbarCompensator( $rows );
|
|
|
|
|
}
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "</tr>\n</table>\n</div>\n";
|
|
|
|
|
$s .= "\n<div id='article'>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-03-27 16:56:11 +00:00
|
|
|
$notice = wfGetSiteNotice();
|
|
|
|
|
if( $notice ) {
|
|
|
|
|
$s .= "\n<div id='siteNotice'>$notice</div>\n";
|
2004-07-16 12:12:35 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= $this->pageTitle();
|
2009-03-29 12:46:11 +00:00
|
|
|
$s .= $this->pageSubtitle();
|
2004-04-28 06:03:45 +00:00
|
|
|
$s .= $this->getCategories();
|
2009-03-29 12:46:11 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2008-03-06 18:54:22 +00:00
|
|
|
function getCategoryLinks() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut, $wgUseCategoryBrowser;
|
2008-02-25 16:38:25 +00:00
|
|
|
global $wgContLang, $wgUser;
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
if( count( $wgOut->mCategoryLinks ) == 0 ) return '';
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-04-24 23:25:12 +00:00
|
|
|
# Separator
|
2009-03-12 12:26:28 +00:00
|
|
|
$sep = wfMsgExt( 'catseparator', array( 'parsemag', 'escapenoentities' ) );
|
2006-04-24 23:25:12 +00:00
|
|
|
|
2005-11-24 00:00:30 +00:00
|
|
|
// Use Unicode bidi embedding override characters,
|
|
|
|
|
// to make sure links don't smash each other up in ugly ways.
|
2009-08-22 01:24:04 +00:00
|
|
|
$dir = $wgContLang->getDir();
|
2005-11-30 22:29:16 +00:00
|
|
|
$embed = "<span dir='$dir'>";
|
2005-11-30 17:29:21 +00:00
|
|
|
$pop = '</span>';
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2008-02-25 16:38:25 +00:00
|
|
|
$allCats = $wgOut->getCategoryLinks();
|
|
|
|
|
$s = '';
|
2008-03-06 18:54:22 +00:00
|
|
|
$colon = wfMsgExt( 'colon-separator', 'escapenoentities' );
|
2008-02-25 16:38:25 +00:00
|
|
|
if ( !empty( $allCats['normal'] ) ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
$t = $embed . implode( "{$pop} {$sep} {$embed}" , $allCats['normal'] ) . $pop;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-03-06 18:54:22 +00:00
|
|
|
$msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escapenoentities' ), count( $allCats['normal'] ) );
|
2008-02-25 16:38:25 +00:00
|
|
|
$s .= '<div id="mw-normal-catlinks">' .
|
2009-03-29 12:46:11 +00:00
|
|
|
$this->link( Title::newFromText( wfMsgForContent( 'pagecategorieslink' ) ), $msg )
|
2008-03-06 18:54:22 +00:00
|
|
|
. $colon . $t . '</div>';
|
2008-02-25 16:38:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Hidden categories
|
|
|
|
|
if ( isset( $allCats['hidden'] ) ) {
|
|
|
|
|
if ( $wgUser->getBoolOption( 'showhiddencats' ) ) {
|
|
|
|
|
$class ='mw-hidden-cats-user-shown';
|
2009-04-09 02:22:36 +00:00
|
|
|
} elseif ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
|
2008-02-25 16:38:25 +00:00
|
|
|
$class = 'mw-hidden-cats-ns-shown';
|
|
|
|
|
} else {
|
|
|
|
|
$class = 'mw-hidden-cats-hidden';
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
$s .= "<div id=\"mw-hidden-catlinks\" class=\"$class\">" .
|
|
|
|
|
wfMsgExt( 'hidden-categories', array( 'parsemag', 'escapenoentities' ), count( $allCats['hidden'] ) ) .
|
2008-03-06 18:54:22 +00:00
|
|
|
$colon . $embed . implode( "$pop $sep $embed", $allCats['hidden'] ) . $pop .
|
2008-02-25 16:38:25 +00:00
|
|
|
"</div>";
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-08-23 00:49:02 +00:00
|
|
|
# optional 'dmoz-like' category browser. Will be shown under the list
|
|
|
|
|
# of categories an article belong to
|
2008-08-21 14:09:57 +00:00
|
|
|
if( $wgUseCategoryBrowser ){
|
2005-02-11 06:37:22 +00:00
|
|
|
$s .= '<br /><hr />';
|
2004-09-03 21:22:20 +00:00
|
|
|
|
2004-08-23 00:49:02 +00:00
|
|
|
# get a big array of the parents tree
|
2009-04-09 02:22:36 +00:00
|
|
|
$parenttree = $this->mTitle->getParentCategoryTree();
|
2005-02-23 22:25:00 +00:00
|
|
|
# Skin object passed by reference cause it can not be
|
2005-08-25 00:39:07 +00:00
|
|
|
# accessed under the method subfunction drawCategoryBrowser
|
2009-03-29 12:46:11 +00:00
|
|
|
$tempout = explode( "\n", Skin::drawCategoryBrowser( $parenttree, $this ) );
|
2005-08-25 00:39:07 +00:00
|
|
|
# Clean out bogus first entry and sort them
|
2009-03-29 12:46:11 +00:00
|
|
|
unset( $tempout[0] );
|
|
|
|
|
asort( $tempout );
|
2005-08-25 00:39:07 +00:00
|
|
|
# Output one per line
|
2009-03-29 12:46:11 +00:00
|
|
|
$s .= implode( "<br />\n", $tempout );
|
2004-06-06 02:06:46 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-05-31 09:04:50 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
/**
|
|
|
|
|
* Render the array as a serie of links.
|
2006-11-08 07:12:03 +00:00
|
|
|
* @param $tree Array: categories tree returned by Title::getParentCategoryTree
|
|
|
|
|
* @param &skin Object: skin passed by reference
|
2006-04-19 15:46:24 +00:00
|
|
|
* @return String separated by >, terminate with "\n"
|
2005-08-25 00:39:07 +00:00
|
|
|
*/
|
2008-08-21 14:09:57 +00:00
|
|
|
function drawCategoryBrowser( $tree, &$skin ){
|
2005-07-02 22:39:22 +00:00
|
|
|
$return = '';
|
2009-03-29 12:46:11 +00:00
|
|
|
foreach( $tree as $element => $parent ) {
|
|
|
|
|
if( empty( $parent ) ) {
|
2005-07-02 22:39:22 +00:00
|
|
|
# element start a new list
|
2005-08-25 00:39:07 +00:00
|
|
|
$return .= "\n";
|
2005-07-02 22:39:22 +00:00
|
|
|
} else {
|
|
|
|
|
# grab the others elements
|
2009-03-29 12:46:11 +00:00
|
|
|
$return .= Skin::drawCategoryBrowser( $parent, $skin ) . ' > ';
|
2005-07-02 22:39:22 +00:00
|
|
|
}
|
|
|
|
|
# add our current element to the list
|
2009-03-29 12:46:11 +00:00
|
|
|
$eltitle = Title::newFromText( $element );
|
|
|
|
|
$return .= $skin->link( $eltitle, $eltitle->getText() );
|
2005-07-02 22:39:22 +00:00
|
|
|
}
|
|
|
|
|
return $return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-31 09:04:50 +00:00
|
|
|
function getCategories() {
|
2004-05-31 22:19:26 +00:00
|
|
|
$catlinks=$this->getCategoryLinks();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-03-09 11:45:12 +00:00
|
|
|
$classes = 'catlinks';
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-30 21:05:44 +00:00
|
|
|
if( strpos( $catlinks, '<div id="mw-normal-catlinks">' ) === false &&
|
|
|
|
|
strpos( $catlinks, '<div id="mw-hidden-catlinks" class="mw-hidden-cats-hidden">' ) !== false ) {
|
2008-03-09 11:45:12 +00:00
|
|
|
$classes .= ' catlinks-allhidden';
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-04-30 21:05:44 +00:00
|
|
|
if( !empty( $catlinks ) ){
|
2008-03-09 11:48:14 +00:00
|
|
|
return "<div id='catlinks' class='$classes'>{$catlinks}</div>";
|
2004-05-31 22:19:26 +00:00
|
|
|
}
|
2004-04-28 06:03:45 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function getQuickbarCompensator( $rows = 1 ) {
|
2003-04-14 23:10:40 +00:00
|
|
|
return "<td width='152' rowspan='{$rows}'> </td>";
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-08 15:53:49 +00:00
|
|
|
/**
|
|
|
|
|
* This runs a hook to allow extensions placing their stuff after content
|
|
|
|
|
* and article metadata (e.g. categories).
|
|
|
|
|
* Note: This function has nothing to do with afterContent().
|
|
|
|
|
*
|
|
|
|
|
* This hook is placed here in order to allow using the same hook for all
|
|
|
|
|
* skins, both the SkinTemplate based ones and the older ones, which directly
|
|
|
|
|
* use this class to get their data.
|
|
|
|
|
*
|
|
|
|
|
* The output of this function gets processed in SkinTemplate::outputPage() for
|
|
|
|
|
* the SkinTemplate based skins, all other skins should directly echo it.
|
|
|
|
|
*
|
|
|
|
|
* Returns an empty string by default, if not changed by any hook function.
|
|
|
|
|
*/
|
2008-08-21 14:09:57 +00:00
|
|
|
protected function afterContentHook() {
|
2009-03-29 12:46:11 +00:00
|
|
|
$data = '';
|
2008-08-08 15:53:49 +00:00
|
|
|
|
2008-08-21 14:09:57 +00:00
|
|
|
if( wfRunHooks( 'SkinAfterContent', array( &$data ) ) ){
|
2008-08-08 15:53:49 +00:00
|
|
|
// adding just some spaces shouldn't toggle the output
|
|
|
|
|
// of the whole <div/>, so we use trim() here
|
2008-08-21 14:09:57 +00:00
|
|
|
if( trim( $data ) != '' ){
|
2008-08-08 15:53:49 +00:00
|
|
|
// Doing this here instead of in the skins to
|
|
|
|
|
// ensure that the div has the same ID in all
|
|
|
|
|
// skins
|
2008-08-09 01:46:25 +00:00
|
|
|
$data = "<div id='mw-data-after-content'>\n" .
|
2008-08-08 15:53:49 +00:00
|
|
|
"\t$data\n" .
|
2008-08-09 01:46:25 +00:00
|
|
|
"</div>\n";
|
2008-08-08 15:53:49 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2008-08-21 14:09:57 +00:00
|
|
|
wfDebug( "Hook SkinAfterContent changed output processing.\n" );
|
2008-08-08 15:53:49 +00:00
|
|
|
}
|
|
|
|
|
|
2008-08-08 16:12:05 +00:00
|
|
|
return $data;
|
2008-08-08 15:53:49 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-08 23:39:17 +00:00
|
|
|
/**
|
|
|
|
|
* Generate debug data HTML for displaying at the bottom of the main content
|
|
|
|
|
* area.
|
|
|
|
|
* @return String HTML containing debug data, if enabled (otherwise empty).
|
|
|
|
|
*/
|
|
|
|
|
protected function generateDebugHTML() {
|
|
|
|
|
global $wgShowDebug, $wgOut;
|
|
|
|
|
if ( $wgShowDebug ) {
|
|
|
|
|
$listInternals = str_replace( "\n", "</li>\n<li>", htmlspecialchars( $wgOut->mDebugtext ) );
|
|
|
|
|
return "\n<hr>\n<strong>Debug data:</strong><ul style=\"font-family:monospace;\"><li>" .
|
|
|
|
|
$listInternals . "</li></ul>\n";
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-03 17:17:03 +00:00
|
|
|
/**
|
2008-08-21 14:09:57 +00:00
|
|
|
* This gets called shortly before the </body> tag.
|
|
|
|
|
* @return String HTML to be put before </body>
|
2005-03-03 17:17:03 +00:00
|
|
|
*/
|
2004-09-02 00:25:56 +00:00
|
|
|
function afterContent() {
|
2004-04-03 10:01:08 +00:00
|
|
|
$printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
|
2009-02-08 23:48:48 +00:00
|
|
|
return $printfooter . $this->generateDebugHTML() . $this->doAfterContent();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-08-09 05:38:11 +00:00
|
|
|
|
2006-07-29 22:34:22 +00:00
|
|
|
/**
|
2008-08-21 14:09:57 +00:00
|
|
|
* This gets called shortly before the </body> tag.
|
|
|
|
|
* @return String HTML-wrapped JS code to be put before </body>
|
2006-07-29 22:34:22 +00:00
|
|
|
*/
|
|
|
|
|
function bottomScripts() {
|
2009-08-11 00:09:24 +00:00
|
|
|
$bottomScriptText = "\n\t\t" . Html::inlineScript( 'if (window.runOnloadHook) runOnloadHook();' ) . "\n";
|
2007-08-23 22:34:12 +00:00
|
|
|
wfRunHooks( 'SkinAfterBottomScripts', array( $this, &$bottomScriptText ) );
|
|
|
|
|
return $bottomScriptText;
|
2006-07-29 22:34:22 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-03 17:17:03 +00:00
|
|
|
/** @return string Retrievied from HTML text */
|
2004-08-09 00:22:43 +00:00
|
|
|
function printSource() {
|
2009-04-09 02:22:36 +00:00
|
|
|
$url = htmlspecialchars( $this->mTitle->getFullURL() );
|
2005-03-03 17:17:03 +00:00
|
|
|
return wfMsg( 'retrievedfrom', '<a href="'.$url.'">'.$url.'</a>' );
|
2004-08-09 00:22:43 +00:00
|
|
|
}
|
2004-08-09 05:38:11 +00:00
|
|
|
|
2004-08-09 00:22:43 +00:00
|
|
|
function printFooter() {
|
|
|
|
|
return "<p>" . $this->printSource() .
|
2008-12-30 21:34:25 +00:00
|
|
|
"</p>\n\n<p>" . $this->pageStats() . "</p>\n";
|
2004-03-21 11:28:44 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2005-03-03 17:17:03 +00:00
|
|
|
/** overloaded by derived classes */
|
2009-03-29 12:46:11 +00:00
|
|
|
function doAfterContent() { return '</div></div>'; }
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function pageTitleLinks() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut, $wgUser, $wgRequest, $wgLang;
|
2004-03-29 14:48:07 +00:00
|
|
|
|
2006-11-29 11:43:58 +00:00
|
|
|
$oldid = $wgRequest->getVal( 'oldid' );
|
|
|
|
|
$diff = $wgRequest->getVal( 'diff' );
|
2004-03-29 14:48:07 +00:00
|
|
|
$action = $wgRequest->getText( 'action' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = $this->printableLink();
|
2004-10-09 08:41:55 +00:00
|
|
|
$disclaimer = $this->disclaimerLink(); # may be empty
|
|
|
|
|
if( $disclaimer ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = $disclaimer;
|
2004-10-09 08:41:55 +00:00
|
|
|
}
|
2005-11-29 20:25:20 +00:00
|
|
|
$privacy = $this->privacyLink(); # may be empty too
|
|
|
|
|
if( $privacy ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = $privacy;
|
2005-11-29 20:25:20 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-01-17 09:49:43 +00:00
|
|
|
if ( $wgOut->isArticleRelated() ) {
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getNamespace() == NS_FILE ) {
|
|
|
|
|
$name = $this->mTitle->getDBkey();
|
|
|
|
|
$image = wfFindFile( $this->mTitle );
|
2007-05-30 21:02:32 +00:00
|
|
|
if( $image ) {
|
2004-12-05 18:54:49 +00:00
|
|
|
$link = htmlspecialchars( $image->getURL() );
|
2006-11-08 07:12:03 +00:00
|
|
|
$style = $this->getInternalLinkAttributes( $link, $name );
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = "<a href=\"{$link}\"{$style}>{$name}</a>";
|
2004-12-05 18:54:49 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-01-17 09:49:43 +00:00
|
|
|
}
|
2004-06-09 01:18:04 +00:00
|
|
|
if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
|
2009-06-07 15:02:12 +00:00
|
|
|
$s[] .= $this->link(
|
|
|
|
|
$this->mTitle,
|
|
|
|
|
wfMsg( 'currentrev' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2004-01-17 09:49:43 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-01-17 09:49:43 +00:00
|
|
|
if ( $wgUser->getNewtalk() ) {
|
2005-12-21 02:47:35 +00:00
|
|
|
# do not show "You have new messages" text when we are viewing our
|
|
|
|
|
# own talk page
|
2009-04-09 02:22:36 +00:00
|
|
|
if( !$this->mTitle->equals( $wgUser->getTalkPage() ) ) {
|
2009-06-07 15:02:12 +00:00
|
|
|
$tl = $this->link(
|
|
|
|
|
$wgUser->getTalkPage(),
|
2009-08-10 19:03:33 +00:00
|
|
|
wfMsgHtml( 'newmessageslink' ),
|
2009-06-07 15:02:12 +00:00
|
|
|
array(),
|
|
|
|
|
array( 'redirect' => 'no' ),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$dl = $this->link(
|
|
|
|
|
$wgUser->getTalkPage(),
|
2009-08-10 19:03:33 +00:00
|
|
|
wfMsgHtml( 'newmessagesdifflink' ),
|
2009-06-07 15:02:12 +00:00
|
|
|
array(),
|
|
|
|
|
array( 'diff' => 'cur' ),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = '<strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
|
2004-09-02 05:59:33 +00:00
|
|
|
# disable caching
|
2009-03-29 12:46:11 +00:00
|
|
|
$wgOut->setSquidMaxage( 0 );
|
|
|
|
|
$wgOut->enableClientCache( false );
|
2003-11-22 12:30:13 +00:00
|
|
|
}
|
2004-01-17 09:49:43 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-06-01 03:41:00 +00:00
|
|
|
$undelete = $this->getUndeleteLink();
|
|
|
|
|
if( !empty( $undelete ) ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = $undelete;
|
2004-01-17 09:49:43 +00:00
|
|
|
}
|
2009-02-09 16:24:03 +00:00
|
|
|
return $wgLang->pipeList( $s );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-06-01 03:41:00 +00:00
|
|
|
function getUndeleteLink() {
|
2009-04-23 20:07:18 +00:00
|
|
|
global $wgUser, $wgContLang, $wgLang, $wgRequest;
|
|
|
|
|
|
|
|
|
|
$action = $wgRequest->getVal( 'action', 'view' );
|
|
|
|
|
|
|
|
|
|
if ( $wgUser->isAllowed( 'deletedhistory' ) &&
|
2009-05-28 17:15:58 +00:00
|
|
|
( $this->mTitle->getArticleId() == 0 || $action == 'history' ) ) {
|
|
|
|
|
$n = $this->mTitle->isDeleted();
|
|
|
|
|
if ( $n ) {
|
|
|
|
|
if ( $wgUser->isAllowed( 'undelete' ) ) {
|
|
|
|
|
$msg = 'thisisdeleted';
|
|
|
|
|
} else {
|
|
|
|
|
$msg = 'viewdeleted';
|
|
|
|
|
}
|
2009-06-07 15:02:12 +00:00
|
|
|
return wfMsg(
|
|
|
|
|
$msg,
|
|
|
|
|
$this->link(
|
2009-05-28 17:15:58 +00:00
|
|
|
SpecialPage::getTitleFor( 'Undelete', $this->mTitle->getPrefixedDBkey() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
)
|
|
|
|
|
);
|
2005-08-07 14:10:17 +00:00
|
|
|
}
|
2004-06-01 03:41:00 +00:00
|
|
|
}
|
2004-06-09 01:18:04 +00:00
|
|
|
return '';
|
2004-06-01 03:41:00 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function printableLink() {
|
2009-02-09 16:24:03 +00:00
|
|
|
global $wgOut, $wgFeedClasses, $wgRequest, $wgLang;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-07-02 09:27:33 +00:00
|
|
|
$s = array();
|
|
|
|
|
|
|
|
|
|
if ( !$wgRequest->getBool( 'printable' ) ) {
|
|
|
|
|
$printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
|
|
|
|
|
$s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-03-19 05:31:18 +00:00
|
|
|
if( $wgOut->isSyndicated() ) {
|
|
|
|
|
foreach( $wgFeedClasses as $format => $class ) {
|
2004-03-19 08:05:36 +00:00
|
|
|
$feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
|
2009-02-14 16:00:51 +00:00
|
|
|
$s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
|
2009-02-17 22:21:02 +00:00
|
|
|
. " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
|
2004-03-19 05:31:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-02-09 16:24:03 +00:00
|
|
|
return $wgLang->pipeList( $s );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function pageTitle() {
|
2006-03-07 01:10:39 +00:00
|
|
|
global $wgOut;
|
2008-12-31 17:02:23 +00:00
|
|
|
$s = '<h1 class="pagetitle">' . $wgOut->getPageTitle() . '</h1>';
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function pageSubtitle() {
|
2004-04-28 15:07:28 +00:00
|
|
|
global $wgOut;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
$sub = $wgOut->getSubtitle();
|
2004-06-09 01:18:04 +00:00
|
|
|
if ( '' == $sub ) {
|
2003-11-09 11:45:12 +00:00
|
|
|
global $wgExtraSubtitle;
|
2008-12-19 08:54:51 +00:00
|
|
|
$sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle;
|
2003-11-09 11:45:12 +00:00
|
|
|
}
|
2004-04-28 15:07:28 +00:00
|
|
|
$subpages = $this->subPageSubtitle();
|
2009-03-29 12:46:11 +00:00
|
|
|
$sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
|
2004-04-28 15:07:28 +00:00
|
|
|
$s = "<p class='subtitle'>{$sub}</p>\n";
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function subPageSubtitle() {
|
2004-04-28 15:07:28 +00:00
|
|
|
$subpages = '';
|
2009-03-29 12:46:11 +00:00
|
|
|
if( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages ) ) )
|
2008-05-21 20:07:10 +00:00
|
|
|
return $subpages;
|
2008-01-29 15:05:48 +00:00
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut;
|
|
|
|
|
if( $wgOut->isArticle() && MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
|
|
|
|
|
$ptext = $this->mTitle->getPrefixedText();
|
2009-03-29 12:46:11 +00:00
|
|
|
if( preg_match( '/\//', $ptext ) ) {
|
|
|
|
|
$links = explode( '/', $ptext );
|
2008-04-20 18:53:46 +00:00
|
|
|
array_pop( $links );
|
2004-06-09 01:18:04 +00:00
|
|
|
$c = 0;
|
|
|
|
|
$growinglink = '';
|
2008-04-20 18:53:46 +00:00
|
|
|
$display = '';
|
2009-03-29 12:46:11 +00:00
|
|
|
foreach( $links as $link ) {
|
2008-04-20 18:53:46 +00:00
|
|
|
$growinglink .= $link;
|
|
|
|
|
$display .= $link;
|
|
|
|
|
$linkObj = Title::newFromText( $growinglink );
|
2008-04-22 16:34:43 +00:00
|
|
|
if( is_object( $linkObj ) && $linkObj->exists() ){
|
2009-06-07 15:02:12 +00:00
|
|
|
$getlink = $this->link(
|
|
|
|
|
$linkObj,
|
|
|
|
|
htmlspecialchars( $display ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2008-04-20 18:53:46 +00:00
|
|
|
$c++;
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $c > 1 ) {
|
|
|
|
|
$subpages .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2004-06-09 01:18:04 +00:00
|
|
|
$subpages .= '< ';
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-04-28 15:07:28 +00:00
|
|
|
$subpages .= $getlink;
|
2008-04-20 18:53:46 +00:00
|
|
|
$display = '';
|
|
|
|
|
} else {
|
|
|
|
|
$display .= '/';
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2008-04-20 18:53:46 +00:00
|
|
|
$growinglink .= '/';
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-04-28 15:07:28 +00:00
|
|
|
return $subpages;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-05 21:42:48 +00:00
|
|
|
/**
|
|
|
|
|
* Returns true if the IP should be shown in the header
|
|
|
|
|
*/
|
|
|
|
|
function showIPinHeader() {
|
|
|
|
|
global $wgShowIPinHeader;
|
|
|
|
|
return $wgShowIPinHeader && session_id() != '';
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function nameAndLogin() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgUser, $wgLang, $wgContLang;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2008-08-01 01:37:07 +00:00
|
|
|
$logoutPage = $wgContLang->specialPage( 'Userlogout' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2008-08-01 01:37:07 +00:00
|
|
|
$ret = '';
|
2005-02-21 12:23:52 +00:00
|
|
|
if ( $wgUser->isAnon() ) {
|
2007-02-05 21:42:48 +00:00
|
|
|
if( $this->showIPinHeader() ) {
|
2008-08-01 01:37:07 +00:00
|
|
|
$name = wfGetIP();
|
2003-05-17 04:40:09 +00:00
|
|
|
|
2008-08-01 01:37:07 +00:00
|
|
|
$talkLink = $this->link( $wgUser->getTalkPage(),
|
|
|
|
|
$wgLang->getNsText( NS_TALK ) );
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-08-01 01:37:07 +00:00
|
|
|
$ret .= "$name ($talkLink)";
|
2003-05-17 04:40:09 +00:00
|
|
|
} else {
|
2008-08-01 01:37:07 +00:00
|
|
|
$ret .= wfMsg( 'notloggedin' );
|
2003-05-17 04:40:09 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
$returnTo = $this->mTitle->getPrefixedDBkey();
|
2008-08-01 01:37:07 +00:00
|
|
|
$query = array();
|
|
|
|
|
if ( $logoutPage != $returnTo ) {
|
|
|
|
|
$query['returnto'] = $returnTo;
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-04-18 15:46:54 +00:00
|
|
|
$loginlink = $wgUser->isAllowed( 'createaccount' )
|
|
|
|
|
? 'nav-login-createaccount'
|
|
|
|
|
: 'login';
|
2008-08-01 01:37:07 +00:00
|
|
|
$ret .= "\n<br />" . $this->link(
|
2006-10-30 06:25:31 +00:00
|
|
|
SpecialPage::getTitleFor( 'Userlogin' ),
|
2008-08-01 01:37:07 +00:00
|
|
|
wfMsg( $loginlink ), array(), $query
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2009-04-09 02:22:36 +00:00
|
|
|
$returnTo = $this->mTitle->getPrefixedDBkey();
|
2008-08-01 01:37:07 +00:00
|
|
|
$talkLink = $this->link( $wgUser->getTalkPage(),
|
|
|
|
|
$wgLang->getNsText( NS_TALK ) );
|
|
|
|
|
|
|
|
|
|
$ret .= $this->link( $wgUser->getUserPage(),
|
|
|
|
|
htmlspecialchars( $wgUser->getName() ) );
|
|
|
|
|
$ret .= " ($talkLink)<br />";
|
2009-02-09 16:24:03 +00:00
|
|
|
$ret .= $wgLang->pipeList( array(
|
|
|
|
|
$this->link(
|
|
|
|
|
SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
|
|
|
|
|
array(), array( 'returnto' => $returnTo )
|
|
|
|
|
),
|
|
|
|
|
$this->specialLink( 'preferences' ),
|
|
|
|
|
) );
|
|
|
|
|
}
|
|
|
|
|
$ret = $wgLang->pipeList( array(
|
|
|
|
|
$ret,
|
|
|
|
|
$this->link(
|
|
|
|
|
Title::newFromText( wfMsgForContent( 'helppage' ) ),
|
|
|
|
|
wfMsg( 'help' )
|
|
|
|
|
),
|
|
|
|
|
) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2008-08-01 01:37:07 +00:00
|
|
|
return $ret;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-04-24 06:25:19 +00:00
|
|
|
function getSearchLink() {
|
2006-11-29 05:45:03 +00:00
|
|
|
$searchPage = SpecialPage::getTitleFor( 'Search' );
|
2004-04-24 06:25:19 +00:00
|
|
|
return $searchPage->getLocalURL();
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-04-24 06:25:19 +00:00
|
|
|
function escapeSearchLink() {
|
|
|
|
|
return htmlspecialchars( $this->getSearchLink() );
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function searchForm() {
|
2009-01-22 23:31:31 +00:00
|
|
|
global $wgRequest, $wgUseTwoButtonsSearchForm;
|
2004-04-24 06:25:19 +00:00
|
|
|
$search = $wgRequest->getText( 'search' );
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-04-22 22:35:50 +00:00
|
|
|
$s = '<form id="searchform'.$this->searchboxes.'" name="search" class="inline" method="post" action="'
|
2004-04-24 06:25:19 +00:00
|
|
|
. $this->escapeSearchLink() . "\">\n"
|
2008-04-22 22:35:50 +00:00
|
|
|
. '<input type="text" id="searchInput'.$this->searchboxes.'" name="search" size="19" value="'
|
2009-03-29 12:46:11 +00:00
|
|
|
. htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
|
|
|
|
|
. '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />';
|
|
|
|
|
|
|
|
|
|
if( $wgUseTwoButtonsSearchForm )
|
|
|
|
|
$s .= ' <input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n";
|
2009-01-22 23:31:31 +00:00
|
|
|
else
|
2009-03-29 12:46:11 +00:00
|
|
|
$s .= ' <a href="' . $this->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n";
|
|
|
|
|
|
2009-01-22 23:31:31 +00:00
|
|
|
$s .= '</form>';
|
2009-03-29 12:46:11 +00:00
|
|
|
|
2008-04-22 22:35:50 +00:00
|
|
|
// Ensure unique id's for search boxes made after the first
|
|
|
|
|
$this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
|
2009-03-29 12:46:11 +00:00
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function topLinks() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgOut;
|
|
|
|
|
|
2009-02-09 16:24:03 +00:00
|
|
|
$s = array(
|
|
|
|
|
$this->mainPageLink(),
|
|
|
|
|
$this->specialLink( 'recentchanges' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-01-17 09:49:43 +00:00
|
|
|
if ( $wgOut->isArticleRelated() ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = $this->editThisPage();
|
|
|
|
|
$s[] = $this->historyLink();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2008-12-31 21:31:20 +00:00
|
|
|
# Many people don't like this dropdown box
|
2009-02-09 16:24:03 +00:00
|
|
|
#$s[] = $this->specialPagesList();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-02-09 16:24:03 +00:00
|
|
|
if( $this->variantLinks() ) {
|
2009-02-18 06:22:38 +00:00
|
|
|
$s[] = $this->variantLinks();
|
2009-02-09 16:24:03 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-02-09 16:24:03 +00:00
|
|
|
if( $this->extensionTabLinks() ) {
|
|
|
|
|
$s[] = $this->extensionTabLinks();
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-02-09 16:24:03 +00:00
|
|
|
// FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
|
2009-03-29 12:46:11 +00:00
|
|
|
return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" );
|
2006-10-24 12:00:51 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-10-31 14:41:59 +00:00
|
|
|
/**
|
|
|
|
|
* Compatibility for extensions adding functionality through tabs.
|
|
|
|
|
* Eventually these old skins should be replaced with SkinTemplate-based
|
|
|
|
|
* versions, sigh...
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function extensionTabLinks() {
|
|
|
|
|
$tabs = array();
|
2009-02-09 16:24:03 +00:00
|
|
|
$out = '';
|
|
|
|
|
$s = array();
|
2006-10-31 14:41:59 +00:00
|
|
|
wfRunHooks( 'SkinTemplateTabs', array( $this, &$tabs ) );
|
|
|
|
|
foreach( $tabs as $tab ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$s[] = Xml::element( 'a',
|
2006-10-31 14:41:59 +00:00
|
|
|
array( 'href' => $tab['href'] ),
|
|
|
|
|
$tab['text'] );
|
|
|
|
|
}
|
2009-02-09 16:24:03 +00:00
|
|
|
|
|
|
|
|
if( count( $s ) ) {
|
|
|
|
|
global $wgLang;
|
|
|
|
|
|
|
|
|
|
$out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
|
|
|
|
|
$out .= $wgLang->pipeList( $s );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $out;
|
2006-10-31 14:41:59 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-10-24 12:00:51 +00:00
|
|
|
/**
|
|
|
|
|
* Language/charset variant links for classic-style skins
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function variantLinks() {
|
|
|
|
|
$s = '';
|
2004-12-24 02:47:38 +00:00
|
|
|
/* show links to different language variants */
|
2009-06-04 09:48:11 +00:00
|
|
|
global $wgDisableLangConversion, $wgLang, $wgContLang;
|
2004-12-24 02:47:38 +00:00
|
|
|
$variants = $wgContLang->getVariants();
|
2009-06-04 09:48:11 +00:00
|
|
|
if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
|
2004-12-24 02:47:38 +00:00
|
|
|
foreach( $variants as $code ) {
|
|
|
|
|
$varname = $wgContLang->getVariantname( $code );
|
|
|
|
|
if( $varname == 'disable' )
|
|
|
|
|
continue;
|
2009-03-29 12:46:11 +00:00
|
|
|
$s = $wgLang->pipeList( array(
|
|
|
|
|
$s,
|
2009-04-09 02:22:36 +00:00
|
|
|
'<a href="' . $this->mTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
|
2009-03-29 12:46:11 +00:00
|
|
|
) );
|
2004-12-24 02:47:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function bottomLinks() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut, $wgUser, $wgUseTrackbacks;
|
2009-03-29 12:46:11 +00:00
|
|
|
$sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = '';
|
2004-01-17 09:49:43 +00:00
|
|
|
if ( $wgOut->isArticleRelated() ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$element[] = '<strong>' . $this->editThisPage() . '</strong>';
|
2005-02-21 12:23:52 +00:00
|
|
|
if ( $wgUser->isLoggedIn() ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$element[] = $this->watchThisPage();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2009-02-09 16:24:03 +00:00
|
|
|
$element[] = $this->talkLink();
|
|
|
|
|
$element[] = $this->historyLink();
|
|
|
|
|
$element[] = $this->whatLinksHere();
|
|
|
|
|
$element[] = $this->watchPageLinksLink();
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgUseTrackbacks )
|
2009-02-09 16:24:03 +00:00
|
|
|
$element[] = $this->trackbackLink();
|
2005-07-23 05:47:25 +00:00
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getNamespace() == NS_USER
|
|
|
|
|
|| $this->mTitle->getNamespace() == NS_USER_TALK ){
|
|
|
|
|
$id = User::idFromName( $this->mTitle->getText() );
|
|
|
|
|
$ip = User::isIP( $this->mTitle->getText() );
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $id || $ip ) { # both anons and non-anons have contri list
|
2009-02-09 16:24:03 +00:00
|
|
|
$element[] = $this->userContribsLink();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-11-25 06:20:01 +00:00
|
|
|
if( $this->showEmailUser( $id ) ) {
|
2009-02-09 16:24:03 +00:00
|
|
|
$element[] = $this->emailUserLink();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2009-02-09 16:24:03 +00:00
|
|
|
$s = implode( $element, $sep );
|
|
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getArticleId() ) {
|
2004-10-24 19:14:48 +00:00
|
|
|
$s .= "\n<br />";
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgUser->isAllowed( 'delete' ) ) { $s .= $this->deleteThisPage(); }
|
|
|
|
|
if( $wgUser->isAllowed( 'protect' ) ) { $s .= $sep . $this->protectThisPage(); }
|
|
|
|
|
if( $wgUser->isAllowed( 'move' ) ) { $s .= $sep . $this->moveThisPage(); }
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-04-03 10:01:08 +00:00
|
|
|
$s .= "<br />\n" . $this->otherLanguages();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2009-02-09 16:24:03 +00:00
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function pageStats() {
|
2004-12-18 03:47:11 +00:00
|
|
|
global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
|
2004-04-29 01:58:20 +00:00
|
|
|
|
2006-11-29 11:43:58 +00:00
|
|
|
$oldid = $wgRequest->getVal( 'oldid' );
|
|
|
|
|
$diff = $wgRequest->getVal( 'diff' );
|
2004-06-09 01:18:04 +00:00
|
|
|
if ( ! $wgOut->isArticle() ) { return ''; }
|
2008-12-31 19:30:59 +00:00
|
|
|
if( !$wgArticle instanceOf Article ) { return ''; }
|
2004-06-09 01:18:04 +00:00
|
|
|
if ( isset( $oldid ) || isset( $diff ) ) { return ''; }
|
|
|
|
|
if ( 0 == $wgArticle->getID() ) { return ''; }
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = '';
|
2008-11-19 12:05:33 +00:00
|
|
|
if ( !$wgDisableCounters ) {
|
|
|
|
|
$count = $wgLang->formatNum( $wgArticle->getCount() );
|
|
|
|
|
if ( $count ) {
|
|
|
|
|
$s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
|
|
|
|
|
}
|
2003-05-01 00:19:49 +00:00
|
|
|
}
|
2004-04-29 01:58:20 +00:00
|
|
|
|
2008-08-18 19:21:55 +00:00
|
|
|
if( $wgMaxCredits != 0 ){
|
|
|
|
|
$s .= ' ' . Credits::getCredits( $wgArticle, $wgMaxCredits, $wgShowCreditsIfMax );
|
2004-04-26 05:14:42 +00:00
|
|
|
} else {
|
2008-08-18 19:21:55 +00:00
|
|
|
$s .= $this->lastModified();
|
2004-04-26 05:14:42 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-08-18 19:21:55 +00:00
|
|
|
if( $wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) {
|
2007-01-22 23:50:42 +00:00
|
|
|
$dbr = wfGetDB( DB_SLAVE );
|
2009-03-29 12:46:11 +00:00
|
|
|
$res = $dbr->select( 'watchlist',
|
|
|
|
|
array( 'COUNT(*) AS n' ),
|
2009-04-09 02:22:36 +00:00
|
|
|
array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
|
2009-03-29 12:46:11 +00:00
|
|
|
__METHOD__
|
|
|
|
|
);
|
2004-12-18 03:47:11 +00:00
|
|
|
$x = $dbr->fetchObject( $res );
|
2007-11-10 14:52:56 +00:00
|
|
|
|
|
|
|
|
$s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview',
|
2009-03-29 12:46:11 +00:00
|
|
|
array( 'parseinline' ), $wgLang->formatNum( $x->n )
|
2007-11-10 14:52:56 +00:00
|
|
|
);
|
2004-12-18 03:47:11 +00:00
|
|
|
}
|
|
|
|
|
|
2004-06-28 17:46:54 +00:00
|
|
|
return $s . ' ' . $this->getCopyright();
|
2004-04-26 05:14:42 +00:00
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-03-16 02:47:49 +00:00
|
|
|
function getCopyright( $type = 'detect' ) {
|
2008-11-08 16:09:37 +00:00
|
|
|
global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest, $wgArticle;
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-03-16 02:47:49 +00:00
|
|
|
if ( $type == 'detect' ) {
|
|
|
|
|
$diff = $wgRequest->getVal( 'diff' );
|
2008-11-08 18:30:04 +00:00
|
|
|
$isCur = $wgArticle && $wgArticle->isCurrent();
|
|
|
|
|
if ( is_null( $diff ) && !$isCur && wfMsgForContent( 'history_copyright' ) !== '-' ) {
|
2006-03-16 02:47:49 +00:00
|
|
|
$type = 'history';
|
|
|
|
|
} else {
|
|
|
|
|
$type = 'normal';
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-03-16 02:47:49 +00:00
|
|
|
if ( $type == 'history' ) {
|
2004-06-21 07:55:16 +00:00
|
|
|
$msg = 'history_copyright';
|
|
|
|
|
} else {
|
|
|
|
|
$msg = 'copyright';
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
$out = '';
|
2004-04-11 01:25:00 +00:00
|
|
|
if( $wgRightsPage ) {
|
2009-06-13 12:24:43 +00:00
|
|
|
$title = Title::newFromText( $wgRightsPage );
|
|
|
|
|
$link = $this->linkKnown( $title, $wgRightsText );
|
2004-04-11 01:25:00 +00:00
|
|
|
} elseif( $wgRightsUrl ) {
|
2006-11-08 07:12:03 +00:00
|
|
|
$link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
|
2008-09-10 02:43:46 +00:00
|
|
|
} elseif( $wgRightsText ) {
|
|
|
|
|
$link = $wgRightsText;
|
2004-04-11 01:25:00 +00:00
|
|
|
} else {
|
|
|
|
|
# Give up now
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
2009-06-24 16:49:28 +00:00
|
|
|
// Allow for site and per-namespace customization of copyright notice.
|
2009-07-08 00:35:47 +00:00
|
|
|
if( isset($wgArticle) )
|
|
|
|
|
wfRunHooks( 'SkinCopyrightFooter', array( $wgArticle->getTitle(), $type, &$msg, &$link ) );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2004-09-26 01:50:26 +00:00
|
|
|
$out .= wfMsgForContent( $msg, $link );
|
2004-04-11 01:25:00 +00:00
|
|
|
return $out;
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-04-11 01:25:00 +00:00
|
|
|
function getCopyrightIcon() {
|
2006-03-07 01:10:39 +00:00
|
|
|
global $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgCopyrightIcon;
|
2004-06-09 01:18:04 +00:00
|
|
|
$out = '';
|
2004-12-28 22:02:19 +00:00
|
|
|
if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
|
|
|
|
|
$out = $wgCopyrightIcon;
|
|
|
|
|
} else if ( $wgRightsIcon ) {
|
2004-04-11 01:25:00 +00:00
|
|
|
$icon = htmlspecialchars( $wgRightsIcon );
|
2004-12-28 22:02:19 +00:00
|
|
|
if ( $wgRightsUrl ) {
|
2004-04-11 01:25:00 +00:00
|
|
|
$url = htmlspecialchars( $wgRightsUrl );
|
2004-06-09 01:18:04 +00:00
|
|
|
$out .= '<a href="'.$url.'">';
|
2004-04-11 01:25:00 +00:00
|
|
|
}
|
|
|
|
|
$text = htmlspecialchars( $wgRightsText );
|
2009-08-13 01:03:48 +00:00
|
|
|
$out .= "<img src=\"$icon\" alt=\"$text\" width=\"88\" height=\"31\" />";
|
2004-12-28 22:02:19 +00:00
|
|
|
if ( $wgRightsUrl ) {
|
2004-06-09 01:18:04 +00:00
|
|
|
$out .= '</a>';
|
2004-04-11 01:25:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-04-11 01:25:00 +00:00
|
|
|
function getPoweredBy() {
|
2004-04-27 12:18:48 +00:00
|
|
|
global $wgStylePath;
|
2004-09-05 03:25:58 +00:00
|
|
|
$url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
|
2009-08-13 00:47:56 +00:00
|
|
|
$img = '<a href="http://www.mediawiki.org/"><img src="'.$url.'" height="31" width="88" alt="Powered by MediaWiki" /></a>';
|
2004-04-11 01:25:00 +00:00
|
|
|
return $img;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function lastModified() {
|
2008-03-30 09:48:15 +00:00
|
|
|
global $wgLang, $wgArticle;
|
2008-07-06 11:01:32 +00:00
|
|
|
if( $this->mRevisionId ) {
|
2008-10-30 10:04:30 +00:00
|
|
|
$timestamp = Revision::getTimestampFromId( $wgArticle->getTitle(), $this->mRevisionId );
|
2008-07-06 11:01:32 +00:00
|
|
|
} else {
|
|
|
|
|
$timestamp = $wgArticle->getTimestamp();
|
|
|
|
|
}
|
2004-04-01 12:46:31 +00:00
|
|
|
if ( $timestamp ) {
|
2006-09-21 16:43:21 +00:00
|
|
|
$d = $wgLang->date( $timestamp, true );
|
|
|
|
|
$t = $wgLang->time( $timestamp, true );
|
2006-09-21 18:29:54 +00:00
|
|
|
$s = ' ' . wfMsg( 'lastmodifiedat', $d, $t );
|
2004-04-01 12:46:31 +00:00
|
|
|
} else {
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = '';
|
2004-04-01 12:46:31 +00:00
|
|
|
}
|
2008-03-30 09:48:15 +00:00
|
|
|
if ( wfGetLB()->getLaggedSlaveMode() ) {
|
2005-01-15 10:40:46 +00:00
|
|
|
$s .= ' <strong>' . wfMsg( 'laggedslavemode' ) . '</strong>';
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function logoText( $align = '' ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
if ( '' != $align ) {
|
|
|
|
|
$a = " align='{$align}'";
|
|
|
|
|
} else {
|
|
|
|
|
$a = '';
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2006-05-31 20:39:14 +00:00
|
|
|
$mp = wfMsg( 'mainpage' );
|
2006-12-03 00:22:14 +00:00
|
|
|
$mptitle = Title::newMainPage();
|
2009-03-29 12:46:11 +00:00
|
|
|
$url = ( is_object( $mptitle ) ? $mptitle->escapeLocalURL() : '' );
|
2004-08-21 11:40:18 +00:00
|
|
|
|
2004-08-22 08:51:28 +00:00
|
|
|
$logourl = $this->getLogo();
|
|
|
|
|
$s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-20 03:45:38 +00:00
|
|
|
/**
|
|
|
|
|
* show a drop-down box of special pages
|
|
|
|
|
*/
|
2004-09-02 00:25:56 +00:00
|
|
|
function specialPagesList() {
|
2006-07-23 12:36:37 +00:00
|
|
|
global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
|
2006-08-23 13:24:16 +00:00
|
|
|
$pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
|
|
|
|
|
foreach ( $pages as $name => $page ) {
|
|
|
|
|
$pages[$name] = $page->getDescription();
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
$go = wfMsg( 'go' );
|
|
|
|
|
$sp = wfMsg( 'specialpages' );
|
2004-09-24 16:24:43 +00:00
|
|
|
$spp = $wgContLang->specialPage( 'Specialpages' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2008-10-10 17:43:17 +00:00
|
|
|
$s = '<form id="specialpages" method="get" ' .
|
2004-06-09 01:18:04 +00:00
|
|
|
'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "<select name=\"wpDropdown\">\n";
|
|
|
|
|
$s .= "<option value=\"{$spp}\">{$sp}</option>\n";
|
|
|
|
|
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2006-08-23 13:24:16 +00:00
|
|
|
foreach ( $pages as $name => $desc ) {
|
2004-09-24 16:24:43 +00:00
|
|
|
$p = $wgContLang->specialPage( $name );
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "<option value=\"{$p}\">{$desc}</option>\n";
|
|
|
|
|
}
|
|
|
|
|
$s .= "</select>\n";
|
2004-04-11 01:25:00 +00:00
|
|
|
$s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "</form>\n";
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function mainPageLink() {
|
2009-06-07 15:02:12 +00:00
|
|
|
$s = $this->link(
|
|
|
|
|
Title::newMainPage(),
|
|
|
|
|
wfMsg( 'mainpage' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-16 03:43:40 +00:00
|
|
|
private function footerLink ( $desc, $page ) {
|
|
|
|
|
// if the link description has been set to "-" in the default language,
|
|
|
|
|
if ( wfMsgForContent( $desc ) == '-') {
|
|
|
|
|
// then it is disabled, for all languages.
|
2005-11-29 20:25:20 +00:00
|
|
|
return '';
|
|
|
|
|
} else {
|
2007-02-16 03:43:40 +00:00
|
|
|
// Otherwise, we display the link for the user, described in their
|
|
|
|
|
// language (which may or may not be the same as the default language),
|
|
|
|
|
// but we make the link target be the one site-wide page.
|
2009-06-15 11:27:48 +00:00
|
|
|
$title = Title::newFromText( wfMsgForContent( $page ) );
|
2009-06-13 12:24:43 +00:00
|
|
|
return $this->linkKnown(
|
|
|
|
|
$title,
|
|
|
|
|
wfMsgExt( $desc, array( 'parsemag', 'escapenoentities' ) )
|
|
|
|
|
);
|
2005-11-29 20:25:20 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-16 03:43:40 +00:00
|
|
|
function privacyLink() {
|
|
|
|
|
return $this->footerLink( 'privacy', 'privacypage' );
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function aboutLink() {
|
2007-02-16 03:43:40 +00:00
|
|
|
return $this->footerLink( 'aboutsite', 'aboutpage' );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function disclaimerLink() {
|
2007-02-16 03:43:40 +00:00
|
|
|
return $this->footerLink( 'disclaimers', 'disclaimerpage' );
|
2004-01-06 06:00:01 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function editThisPage() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut;
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2008-03-14 13:23:48 +00:00
|
|
|
if ( !$wgOut->isArticleRelated() ) {
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = wfMsg( 'protectedpage' );
|
2003-12-25 03:25:17 +00:00
|
|
|
} else {
|
2009-04-09 02:22:36 +00:00
|
|
|
if( $this->mTitle->quickUserCan( 'edit' ) && $this->mTitle->exists() ) {
|
2004-06-09 01:18:04 +00:00
|
|
|
$t = wfMsg( 'editthispage' );
|
2009-04-09 02:22:36 +00:00
|
|
|
} elseif( $this->mTitle->quickUserCan( 'create' ) && !$this->mTitle->exists() ) {
|
2008-03-14 13:23:48 +00:00
|
|
|
$t = wfMsg( 'create-this-page' );
|
2003-12-25 03:25:17 +00:00
|
|
|
} else {
|
2004-06-09 01:18:04 +00:00
|
|
|
$t = wfMsg( 'viewsource' );
|
2003-12-25 03:25:17 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-06-07 15:02:12 +00:00
|
|
|
$s = $this->link(
|
|
|
|
|
$this->mTitle,
|
|
|
|
|
$t,
|
|
|
|
|
array(),
|
|
|
|
|
$this->editUrlOptions(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2005-12-01 09:47:44 +00:00
|
|
|
/**
|
|
|
|
|
* Return URL options for the 'edit page' link.
|
|
|
|
|
* This may include an 'oldid' specifier, if the current page view is such.
|
|
|
|
|
*
|
2009-06-07 15:02:12 +00:00
|
|
|
* @return array
|
2006-04-19 15:46:24 +00:00
|
|
|
* @private
|
2005-12-01 09:47:44 +00:00
|
|
|
*/
|
|
|
|
|
function editUrlOptions() {
|
2005-12-01 19:09:45 +00:00
|
|
|
global $wgArticle;
|
2006-01-07 13:31:29 +00:00
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$options = array( 'action' => 'edit' );
|
2009-06-07 15:02:12 +00:00
|
|
|
|
2005-12-01 19:09:45 +00:00
|
|
|
if( $this->mRevisionId && ! $wgArticle->isCurrent() ) {
|
2009-06-07 15:02:12 +00:00
|
|
|
$options['oldid'] = intval( $this->mRevisionId );
|
2005-12-01 09:47:44 +00:00
|
|
|
}
|
2009-06-07 15:02:12 +00:00
|
|
|
|
|
|
|
|
return $options;
|
2005-12-01 09:47:44 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function deleteThisPage() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgUser, $wgRequest;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-03-29 14:48:07 +00:00
|
|
|
$diff = $wgRequest->getVal( 'diff' );
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
|
2004-06-09 01:18:04 +00:00
|
|
|
$t = wfMsg( 'deletethispage' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-06-07 15:02:12 +00:00
|
|
|
$s = $this->link(
|
|
|
|
|
$this->mTitle,
|
|
|
|
|
$t,
|
|
|
|
|
array(),
|
|
|
|
|
array( 'action' => 'delete' ),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = '';
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function protectThisPage() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgUser, $wgRequest;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-03-29 14:48:07 +00:00
|
|
|
$diff = $wgRequest->getVal( 'diff' );
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
|
|
|
|
|
if ( $this->mTitle->isProtected() ) {
|
2009-06-07 15:02:12 +00:00
|
|
|
$text = wfMsg( 'unprotectthispage' );
|
|
|
|
|
$query = array( 'action' => 'unprotect' );
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2009-06-07 15:02:12 +00:00
|
|
|
$text = wfMsg( 'protectthispage' );
|
|
|
|
|
$query = array( 'action' => 'protect' );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2009-06-07 15:02:12 +00:00
|
|
|
|
|
|
|
|
$s = $this->link(
|
|
|
|
|
$this->mTitle,
|
|
|
|
|
$text,
|
|
|
|
|
array(),
|
|
|
|
|
$query,
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = '';
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function watchThisPage() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut;
|
2006-12-26 23:53:34 +00:00
|
|
|
++$this->mWatchLinkNum;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-01-17 09:49:43 +00:00
|
|
|
if ( $wgOut->isArticleRelated() ) {
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->userIsWatching() ) {
|
2009-06-07 15:02:12 +00:00
|
|
|
$text = wfMsg( 'unwatchthispage' );
|
|
|
|
|
$query = array( 'action' => 'unwatch' );
|
2009-06-13 12:24:43 +00:00
|
|
|
$id = 'mw-unwatch-link' . $this->mWatchLinkNum;
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2009-06-07 15:02:12 +00:00
|
|
|
$text = wfMsg( 'watchthispage' );
|
|
|
|
|
$query = array( 'action' => 'watch' );
|
2009-06-13 12:24:43 +00:00
|
|
|
$id = 'mw-watch-link' . $this->mWatchLinkNum;
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2009-06-07 15:02:12 +00:00
|
|
|
|
|
|
|
|
$s = $this->link(
|
|
|
|
|
$this->mTitle,
|
|
|
|
|
$text,
|
|
|
|
|
array( 'id' => $id ),
|
|
|
|
|
$query,
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2004-06-09 01:18:04 +00:00
|
|
|
$s = wfMsg( 'notanarticle' );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function moveThisPage() {
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->quickUserCan( 'move' ) ) {
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
|
|
|
|
SpecialPage::getTitleFor( 'Movepage' ),
|
|
|
|
|
wfMsg( 'movethispage' ),
|
|
|
|
|
array(),
|
2009-07-17 00:01:48 +00:00
|
|
|
array( 'target' => $this->mTitle->getPrefixedDBkey() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2005-01-22 06:11:10 +00:00
|
|
|
} else {
|
|
|
|
|
// no message if page is protected - would be redundant
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function historyLink() {
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
|
|
|
|
$this->mTitle,
|
|
|
|
|
wfMsgHtml( 'history' ),
|
|
|
|
|
array( 'rel' => 'archives' ),
|
|
|
|
|
array( 'action' => 'history' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function whatLinksHere() {
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
2009-04-09 02:22:36 +00:00
|
|
|
SpecialPage::getTitleFor( 'Whatlinkshere', $this->mTitle->getPrefixedDBkey() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
wfMsgHtml( 'whatlinkshere' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function userContribsLink() {
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
2009-04-09 02:22:36 +00:00
|
|
|
SpecialPage::getTitleFor( 'Contributions', $this->mTitle->getDBkey() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
wfMsgHtml( 'contributions' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-11-25 06:20:01 +00:00
|
|
|
function showEmailUser( $id ) {
|
2008-10-17 22:20:07 +00:00
|
|
|
global $wgUser;
|
|
|
|
|
$targetUser = User::newFromId( $id );
|
|
|
|
|
return $wgUser->canSendEmail() && # the sending user must have a confirmed email address
|
|
|
|
|
$targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
|
2004-11-25 06:20:01 +00:00
|
|
|
}
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function emailUserLink() {
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
2009-04-09 02:22:36 +00:00
|
|
|
SpecialPage::getTitleFor( 'Emailuser', $this->mTitle->getDBkey() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
wfMsg( 'emailuser' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function watchPageLinksLink() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut;
|
2004-01-17 09:49:43 +00:00
|
|
|
if ( ! $wgOut->isArticleRelated() ) {
|
2005-02-21 11:28:07 +00:00
|
|
|
return '(' . wfMsg( 'notanarticle' ) . ')';
|
2003-04-14 23:10:40 +00:00
|
|
|
} else {
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
2009-04-09 02:22:36 +00:00
|
|
|
SpecialPage::getTitleFor( 'Recentchangeslinked', $this->mTitle->getPrefixedDBkey() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
wfMsg( 'recentchangeslinked-toolbox' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-23 05:47:25 +00:00
|
|
|
function trackbackLink() {
|
2009-04-09 02:22:36 +00:00
|
|
|
return '<a href="' . $this->mTitle->trackbackURL() . '">'
|
2009-03-29 12:46:11 +00:00
|
|
|
. wfMsg( 'trackbacklink' ) . '</a>';
|
2005-07-23 05:47:25 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function otherLanguages() {
|
2006-05-31 20:39:14 +00:00
|
|
|
global $wgOut, $wgContLang, $wgHideInterlanguageLinks;
|
2005-05-28 06:56:30 +00:00
|
|
|
|
|
|
|
|
if ( $wgHideInterlanguageLinks ) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
$a = $wgOut->getLanguageLinks();
|
|
|
|
|
if ( 0 == count( $a ) ) {
|
2005-02-21 11:28:07 +00:00
|
|
|
return '';
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2009-01-07 22:49:54 +00:00
|
|
|
$s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' );
|
2003-04-14 23:10:40 +00:00
|
|
|
$first = true;
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgContLang->isRTL() ) $s .= '<span dir="LTR">';
|
2003-04-14 23:10:40 +00:00
|
|
|
foreach( $a as $l ) {
|
2009-03-29 12:46:11 +00:00
|
|
|
if ( !$first ) {
|
|
|
|
|
$s .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
$first = false;
|
|
|
|
|
|
|
|
|
|
$nt = Title::newFromText( $l );
|
2005-02-21 11:28:07 +00:00
|
|
|
$url = $nt->escapeFullURL();
|
2006-05-31 20:39:14 +00:00
|
|
|
$text = $wgContLang->getLanguageName( $nt->getInterwiki() );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-06-09 01:18:04 +00:00
|
|
|
if ( '' == $text ) { $text = $l; }
|
2009-07-12 23:32:16 +00:00
|
|
|
$style = $this->getExternalLinkAttributes();
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
|
|
|
|
|
}
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $wgContLang->isRTL() ) $s .= '</span>';
|
2003-04-14 23:10:40 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function talkLink() {
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( NS_SPECIAL == $this->mTitle->getNamespace() ) {
|
2005-02-21 11:28:07 +00:00
|
|
|
# No discussion links for special pages
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2008-08-21 07:42:43 +00:00
|
|
|
$linkOptions = array();
|
|
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
if( $this->mTitle->isTalkPage() ) {
|
|
|
|
|
$link = $this->mTitle->getSubjectPage();
|
2005-02-21 11:28:07 +00:00
|
|
|
switch( $link->getNamespace() ) {
|
2006-08-03 12:38:24 +00:00
|
|
|
case NS_MAIN:
|
|
|
|
|
$text = wfMsg( 'articlepage' );
|
|
|
|
|
break;
|
|
|
|
|
case NS_USER:
|
|
|
|
|
$text = wfMsg( 'userpage' );
|
|
|
|
|
break;
|
|
|
|
|
case NS_PROJECT:
|
|
|
|
|
$text = wfMsg( 'projectpage' );
|
|
|
|
|
break;
|
2008-12-01 17:14:30 +00:00
|
|
|
case NS_FILE:
|
2006-08-03 12:38:24 +00:00
|
|
|
$text = wfMsg( 'imagepage' );
|
2008-08-21 07:42:43 +00:00
|
|
|
# Make link known if image exists, even if the desc. page doesn't.
|
|
|
|
|
if( wfFindFile( $link ) )
|
|
|
|
|
$linkOptions[] = 'known';
|
2006-08-03 12:38:24 +00:00
|
|
|
break;
|
|
|
|
|
case NS_MEDIAWIKI:
|
|
|
|
|
$text = wfMsg( 'mediawikipage' );
|
|
|
|
|
break;
|
|
|
|
|
case NS_TEMPLATE:
|
|
|
|
|
$text = wfMsg( 'templatepage' );
|
|
|
|
|
break;
|
|
|
|
|
case NS_HELP:
|
|
|
|
|
$text = wfMsg( 'viewhelppage' );
|
|
|
|
|
break;
|
|
|
|
|
case NS_CATEGORY:
|
|
|
|
|
$text = wfMsg( 'categorypage' );
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$text = wfMsg( 'articlepage' );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2009-04-09 02:22:36 +00:00
|
|
|
$link = $this->mTitle->getTalkPage();
|
2005-02-21 11:28:07 +00:00
|
|
|
$text = wfMsg( 'talkpage' );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2008-08-21 07:42:43 +00:00
|
|
|
$s = $this->link( $link, $text, array(), array(), $linkOptions );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 00:25:56 +00:00
|
|
|
function commentLink() {
|
2009-04-09 02:22:36 +00:00
|
|
|
global $wgOut;
|
2003-11-22 12:30:13 +00:00
|
|
|
|
2009-04-09 02:22:36 +00:00
|
|
|
if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
|
2005-02-21 11:28:07 +00:00
|
|
|
return '';
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-05-01 20:35:08 +00:00
|
|
|
# __NEWSECTIONLINK___ changes behaviour here
|
2009-06-07 15:02:12 +00:00
|
|
|
# If it is present, the link points to this page, otherwise
|
2006-05-01 20:35:08 +00:00
|
|
|
# it points to the talk page
|
2009-04-09 02:22:36 +00:00
|
|
|
if( $this->mTitle->isTalkPage() ) {
|
|
|
|
|
$title = $this->mTitle;
|
2006-05-01 20:35:08 +00:00
|
|
|
} elseif( $wgOut->showNewSectionLink() ) {
|
2009-04-09 02:22:36 +00:00
|
|
|
$title = $this->mTitle;
|
2006-05-01 20:35:08 +00:00
|
|
|
} else {
|
2009-04-09 02:22:36 +00:00
|
|
|
$title = $this->mTitle->getTalkPage();
|
2006-05-01 20:35:08 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-06-07 15:02:12 +00:00
|
|
|
return $this->link(
|
|
|
|
|
$title,
|
|
|
|
|
wfMsg( 'postcomment' ),
|
|
|
|
|
array(),
|
|
|
|
|
array(
|
|
|
|
|
'action' => 'edit',
|
|
|
|
|
'section' => 'new'
|
|
|
|
|
),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2003-11-22 12:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
2006-02-18 04:34:10 +00:00
|
|
|
/* these are used extensively in SkinTemplate, but also some other places */
|
2006-12-03 00:22:14 +00:00
|
|
|
static function makeMainPageUrl( $urlaction = '' ) {
|
|
|
|
|
$title = Title::newMainPage();
|
2007-01-12 10:03:51 +00:00
|
|
|
self::checkTitle( $title, '' );
|
2006-12-03 00:22:14 +00:00
|
|
|
return $title->getLocalURL( $urlaction );
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeSpecialUrl( $name, $urlaction = '' ) {
|
2006-10-30 06:25:31 +00:00
|
|
|
$title = SpecialPage::getTitleFor( $name );
|
2004-05-05 12:01:54 +00:00
|
|
|
return $title->getLocalURL( $urlaction );
|
|
|
|
|
}
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2006-12-18 00:20:21 +00:00
|
|
|
static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) {
|
2006-12-18 00:46:36 +00:00
|
|
|
$title = SpecialPage::getSafeTitleFor( $name, $subpage );
|
2006-12-18 00:20:21 +00:00
|
|
|
return $title->getLocalURL( $urlaction );
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeI18nUrl( $name, $urlaction = '' ) {
|
|
|
|
|
$title = Title::newFromText( wfMsgForContent( $name ) );
|
|
|
|
|
self::checkTitle( $title, $name );
|
2004-05-05 12:01:54 +00:00
|
|
|
return $title->getLocalURL( $urlaction );
|
|
|
|
|
}
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeUrl( $name, $urlaction = '' ) {
|
2004-05-05 12:01:54 +00:00
|
|
|
$title = Title::newFromText( $name );
|
2006-09-22 13:07:06 +00:00
|
|
|
self::checkTitle( $title, $name );
|
2004-07-16 20:50:16 +00:00
|
|
|
return $title->getLocalURL( $urlaction );
|
2004-05-05 12:01:54 +00:00
|
|
|
}
|
2004-09-26 09:45:35 +00:00
|
|
|
|
|
|
|
|
# If url string starts with http, consider as external URL, else
|
|
|
|
|
# internal
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeInternalOrExternalUrl( $name ) {
|
2005-10-30 11:24:43 +00:00
|
|
|
if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $name ) ) {
|
2004-09-26 09:45:35 +00:00
|
|
|
return $name;
|
|
|
|
|
} else {
|
2006-09-22 13:07:06 +00:00
|
|
|
return self::makeUrl( $name );
|
2004-09-26 09:45:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-03 01:29:02 +00:00
|
|
|
# this can be passed the NS number as defined in Language.php
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN ) {
|
2004-08-22 23:55:36 +00:00
|
|
|
$title = Title::makeTitleSafe( $namespace, $name );
|
2006-09-22 13:07:06 +00:00
|
|
|
self::checkTitle( $title, $name );
|
2004-06-03 01:29:02 +00:00
|
|
|
return $title->getLocalURL( $urlaction );
|
|
|
|
|
}
|
2004-07-16 20:50:16 +00:00
|
|
|
|
2004-05-13 19:44:13 +00:00
|
|
|
/* these return an array with the 'href' and boolean 'exists' */
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeUrlDetails( $name, $urlaction = '' ) {
|
2004-05-13 19:44:13 +00:00
|
|
|
$title = Title::newFromText( $name );
|
2006-09-22 13:07:06 +00:00
|
|
|
self::checkTitle( $title, $name );
|
2004-07-16 20:50:16 +00:00
|
|
|
return array(
|
2004-05-13 19:44:13 +00:00
|
|
|
'href' => $title->getLocalURL( $urlaction ),
|
2006-09-22 13:07:06 +00:00
|
|
|
'exists' => $title->getArticleID() != 0 ? true : false
|
2004-07-16 20:50:16 +00:00
|
|
|
);
|
2004-05-13 19:44:13 +00:00
|
|
|
}
|
2004-05-05 12:01:54 +00:00
|
|
|
|
2005-10-22 20:52:30 +00:00
|
|
|
/**
|
|
|
|
|
* Make URL details where the article exists (or at least it's convenient to think so)
|
|
|
|
|
*/
|
2006-09-22 13:07:06 +00:00
|
|
|
static function makeKnownUrlDetails( $name, $urlaction = '' ) {
|
2005-10-22 20:52:30 +00:00
|
|
|
$title = Title::newFromText( $name );
|
2006-09-22 13:07:06 +00:00
|
|
|
self::checkTitle( $title, $name );
|
2005-10-22 20:52:30 +00:00
|
|
|
return array(
|
|
|
|
|
'href' => $title->getLocalURL( $urlaction ),
|
|
|
|
|
'exists' => true
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-15 03:38:35 +00:00
|
|
|
# make sure we have some title to operate on
|
2007-01-12 10:03:51 +00:00
|
|
|
static function checkTitle( &$title, $name ) {
|
2006-09-22 13:07:06 +00:00
|
|
|
if( !is_object( $title ) ) {
|
2004-05-05 12:01:54 +00:00
|
|
|
$title = Title::newFromText( $name );
|
2006-09-22 13:07:06 +00:00
|
|
|
if( !is_object( $title ) ) {
|
2004-06-24 21:33:43 +00:00
|
|
|
$title = Title::newFromText( '--error: link target missing--' );
|
2004-05-05 12:01:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-28 14:18:08 +00:00
|
|
|
/**
|
|
|
|
|
* Build an array that represents the sidebar(s), the navigation bar among them
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
2005-07-03 04:00:33 +00:00
|
|
|
*/
|
2005-06-28 14:18:08 +00:00
|
|
|
function buildSidebar() {
|
2008-02-09 09:11:45 +00:00
|
|
|
global $parserMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
|
2008-06-03 20:24:00 +00:00
|
|
|
global $wgLang;
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
2005-07-03 04:00:33 +00:00
|
|
|
|
2008-06-03 20:24:00 +00:00
|
|
|
$key = wfMemcKey( 'sidebar', $wgLang->getCode() );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-06-03 20:24:00 +00:00
|
|
|
if ( $wgEnableSidebarCache ) {
|
2006-04-14 08:26:35 +00:00
|
|
|
$cachedsidebar = $parserMemc->get( $key );
|
2008-06-03 20:24:00 +00:00
|
|
|
if ( $cachedsidebar ) {
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
2006-01-14 22:13:43 +00:00
|
|
|
return $cachedsidebar;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-28 14:18:08 +00:00
|
|
|
$bar = array();
|
|
|
|
|
$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
|
2008-01-24 20:14:35 +00:00
|
|
|
$heading = '';
|
2009-03-29 12:46:11 +00:00
|
|
|
foreach( $lines as $line ) {
|
|
|
|
|
if( strpos( $line, '*' ) !== 0 )
|
2005-06-28 14:18:08 +00:00
|
|
|
continue;
|
2009-03-29 12:46:11 +00:00
|
|
|
if( strpos( $line, '**') !== 0 ) {
|
2009-04-09 05:27:25 +00:00
|
|
|
$heading = trim( $line, '* ' );
|
2009-03-29 12:46:11 +00:00
|
|
|
if( !array_key_exists( $heading, $bar ) ) $bar[$heading] = array();
|
2005-06-28 14:18:08 +00:00
|
|
|
} else {
|
2009-03-29 12:46:11 +00:00
|
|
|
if( strpos( $line, '|' ) !== false ) { // sanity check
|
|
|
|
|
$line = array_map( 'trim', explode( '|', trim( $line, '* ' ), 2 ) );
|
2005-06-28 14:18:08 +00:00
|
|
|
$link = wfMsgForContent( $line[0] );
|
2009-03-29 12:46:11 +00:00
|
|
|
if( $link == '-' )
|
2005-06-28 14:18:08 +00:00
|
|
|
continue;
|
2008-12-19 08:54:51 +00:00
|
|
|
|
2009-03-29 12:46:11 +00:00
|
|
|
$text = wfMsgExt( $line[1], 'parsemag' );
|
|
|
|
|
if( wfEmptyMsg( $line[1], $text ) )
|
2005-08-08 13:26:42 +00:00
|
|
|
$text = $line[1];
|
2009-03-29 12:46:11 +00:00
|
|
|
if( wfEmptyMsg( $line[0], $link ) )
|
2005-08-08 13:26:42 +00:00
|
|
|
$link = $line[0];
|
2006-10-30 06:25:31 +00:00
|
|
|
|
|
|
|
|
if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) {
|
|
|
|
|
$href = $link;
|
|
|
|
|
} else {
|
|
|
|
|
$title = Title::newFromText( $link );
|
2006-11-01 11:21:46 +00:00
|
|
|
if ( $title ) {
|
|
|
|
|
$title = $title->fixSpecialName();
|
|
|
|
|
$href = $title->getLocalURL();
|
|
|
|
|
} else {
|
|
|
|
|
$href = 'INVALID-TITLE';
|
|
|
|
|
}
|
2006-10-30 06:25:31 +00:00
|
|
|
}
|
|
|
|
|
|
2005-06-28 14:18:08 +00:00
|
|
|
$bar[$heading][] = array(
|
2005-08-08 13:26:42 +00:00
|
|
|
'text' => $text,
|
2005-10-11 23:46:00 +00:00
|
|
|
'href' => $href,
|
2009-03-29 12:46:11 +00:00
|
|
|
'id' => 'n-' . strtr( $line[1], ' ', '-' ),
|
2006-01-14 22:13:43 +00:00
|
|
|
'active' => false
|
2005-06-28 14:18:08 +00:00
|
|
|
);
|
|
|
|
|
} else { continue; }
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-03-29 12:46:11 +00:00
|
|
|
wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) );
|
2008-06-03 20:24:00 +00:00
|
|
|
if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
2005-06-28 14:18:08 +00:00
|
|
|
return $bar;
|
|
|
|
|
}
|
2009-07-07 21:49:45 +00:00
|
|
|
|
|
|
|
|
/**
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
* Should we include common/wikiprintable.css? Skins that have their own
|
|
|
|
|
* print stylesheet should override this and return false. (This is an
|
|
|
|
|
* ugly hack to get Monobook to play nicely with
|
2009-07-07 21:49:45 +00:00
|
|
|
* OutputPage::headElement().)
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function commonPrintStylesheet() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2009-08-01 16:44:44 +00:00
|
|
|
}
|