return $this;
}
+ /**
+ * Get header text.
+ *
+ * @param string|null $section The section to get the header text for
+ * @since 1.26
+ * @return string
+ */
+ function getHeaderText( $section = null ) {
+ if ( is_null( $section ) ) {
+ return $this->mHeader;
+ } else {
+ return isset( $this->mSectionHeaders[$section] ) ? $this->mSectionHeaders[$section] : '';
+ }
+ }
+
/**
* Add footer text, inside the form.
*
return $this;
}
+ /**
+ * Get footer text.
+ *
+ * @param string|null $section The section to get the footer text for
+ * @since 1.26
+ * @return string
+ */
+ function getFooterText( $section = null ) {
+ if ( is_null( $section ) ) {
+ return $this->mFooter;
+ } else {
+ return isset( $this->mSectionFooters[$section] ) ? $this->mSectionFooters[$section] : '';
+ }
+ }
+
/**
* Add text to the end of the display.
*
# For good measure (it is the default)
$this->getOutput()->preventClickjacking();
$this->getOutput()->addModules( 'mediawiki.htmlform' );
+ $this->getOutput()->addModuleStyles( 'mediawiki.htmlform.styles' );
$html = ''
. $this->getErrors( $submitResult )
- // In OOUI forms, we handle mHeader elsewhere. FIXME This is horrible.
- . ( $this->getDisplayFormat() === 'ooui' ? '' : $this->mHeader )
+ . $this->getHeaderText()
. $this->getBody()
. $this->getHiddenFields()
. $this->getButtons()
- . $this->mFooter;
+ . $this->getFooterText();
$html = $this->wrapForm( $html );
&$hasUserVisibleFields = false ) {
$displayFormat = $this->getDisplayFormat();
- $html = '';
+ $html = array();
$subsectionHtml = '';
$hasLabel = false;
$v = empty( $value->mParams['nodata'] )
? $this->mFieldData[$key]
: $value->getDefault();
- $html .= $value->$getFieldHtmlMethod( $v );
+ $html[] = $value->$getFieldHtmlMethod( $v );
$labelValue = trim( $value->getLabel() );
if ( $labelValue != ' ' && $labelValue !== '' ) {
$legend = $this->getLegend( $key );
- if ( isset( $this->mSectionHeaders[$key] ) ) {
- $section = $this->mSectionHeaders[$key] . $section;
- }
- if ( isset( $this->mSectionFooters[$key] ) ) {
- $section .= $this->mSectionFooters[$key];
- }
+ $section = $this->getHeaderText( $key ) .
+ $section .
+ $this->getFooterText( $key );
$attributes = array();
if ( $fieldsetIDPrefix ) {
}
}
- if ( $displayFormat !== 'raw' ) {
- $classes = array();
-
- if ( !$hasLabel ) { // Avoid strange spacing when no labels exist
- $classes[] = 'mw-htmlform-nolabel';
- }
-
- $attribs = array(
- 'class' => implode( ' ', $classes ),
- );
-
- if ( $sectionName ) {
- $attribs['id'] = Sanitizer::escapeId( $sectionName );
- }
-
- if ( $displayFormat === 'table' ) {
- $html = Html::rawElement( 'table',
- $attribs,
- Html::rawElement( 'tbody', array(), "\n$html\n" ) ) . "\n";
- } elseif ( $displayFormat === 'inline' ) {
- $html = Html::rawElement( 'span', $attribs, "\n$html\n" );
- } elseif ( $displayFormat === 'ooui' ) {
- $config = array(
- 'classes' => $classes,
- );
- if ( $sectionName ) {
- $config['id'] = Sanitizer::escapeId( $sectionName );
- }
- if ( is_string( $this->mWrapperLegend ) ) {
- $config['label'] = $this->mWrapperLegend;
- }
- $fieldset = new OOUI\FieldsetLayout( $config );
- // Ewww. We should pass this as $config['items'], but there might be string snippets.
- $fieldset->group->appendContent( new OOUI\HtmlSnippet( $html ) );
- $html = $fieldset;
- } else {
- $html = Html::rawElement( 'div', $attribs, "\n$html\n" );
- }
- }
+ $html = $this->formatSection( $html, $sectionName, $hasLabel );
if ( $subsectionHtml ) {
if ( $this->mSubSectionBeforeFields ) {
}
}
+ /**
+ * Put a form section together from the individual fields' HTML, merging it and wrapping.
+ * @param array $fieldsHtml
+ * @param string $sectionName
+ * @param bool $anyFieldHasLabel
+ * @return string HTML
+ */
+ protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
+ $displayFormat = $this->getDisplayFormat();
+ $html = implode( '', $fieldsHtml );
+
+ if ( $displayFormat === 'raw' ) {
+ return $html;
+ }
+
+ $classes = array();
+
+ if ( !$anyFieldHasLabel ) { // Avoid strange spacing when no labels exist
+ $classes[] = 'mw-htmlform-nolabel';
+ }
+
+ $attribs = array(
+ 'class' => implode( ' ', $classes ),
+ );
+
+ if ( $sectionName ) {
+ $attribs['id'] = Sanitizer::escapeId( $sectionName );
+ }
+
+ if ( $displayFormat === 'table' ) {
+ return Html::rawElement( 'table',
+ $attribs,
+ Html::rawElement( 'tbody', array(), "\n$html\n" ) ) . "\n";
+ } elseif ( $displayFormat === 'inline' ) {
+ return Html::rawElement( 'span', $attribs, "\n$html\n" );
+ } else {
+ return Html::rawElement( 'div', $attribs, "\n$html\n" );
+ }
+ }
+
/**
* Construct the form fields from the Descriptor array
*/
'resources/lib/phpjs-sha1/sha1.js',
'resources/src/mediawiki/mediawiki.js',
'resources/src/mediawiki/mediawiki.errorLogger.js',
- 'resources/src/mediawiki/mediawiki.startUp.js',
),
'debugScripts' => 'resources/src/mediawiki/mediawiki.log.js',
'targets' => array( 'desktop', 'mobile' ),
'resources/src/mediawiki/mediawiki.template.mustache.js',
),
'targets' => array( 'desktop', 'mobile' ),
+ 'dependencies' => 'mediawiki.template',
+ ),
+ 'mediawiki.template.regexp' => array(
+ 'scripts' => 'resources/src/mediawiki/mediawiki.template.regexp.js',
+ 'targets' => array( 'desktop', 'mobile' ),
+ 'dependencies' => 'mediawiki.template',
),
'mediawiki.apipretty' => array(
'styles' => 'resources/src/mediawiki/mediawiki.apipretty.css',
'oojs-ui',
),
),
+ 'mediawiki.ForeignApi' => array(
+ 'targets' => array( 'desktop', 'mobile' ),
+ 'class' => 'ResourceLoaderForeignApiModule',
+ // Additional dependencies generated dynamically
+ 'dependencies' => 'mediawiki.ForeignApi.core',
+ ),
+ 'mediawiki.ForeignApi.core' => array(
+ 'scripts' => 'resources/src/mediawiki.api/mediawiki.ForeignApi.js',
+ 'dependencies' => array(
+ 'mediawiki.api',
+ 'oojs',
+ ),
+ 'targets' => array( 'desktop', 'mobile' ),
+ ),
'mediawiki.helplink' => array(
'position' => 'top',
'styles' => array(
'colon-separator',
),
),
+ 'mediawiki.htmlform.styles' => array(
+ 'styles' => 'resources/src/mediawiki/mediawiki.htmlform.css',
+ 'position' => 'top',
+ ),
'mediawiki.htmlform.ooui.styles' => array(
'styles' => 'resources/src/mediawiki/mediawiki.htmlform.ooui.css',
'position' => 'top',
'mediawiki.api.upload',
),
),
+ 'mediawiki.ForeignUpload' => array(
+ 'scripts' => 'resources/src/mediawiki/mediawiki.ForeignUpload.js',
+ 'dependencies' => array(
+ 'mediawiki.ForeignApi',
+ 'mediawiki.Upload',
+ 'oojs',
+ ),
+ ),
+ 'mediawiki.ForeignStructuredUpload' => array(
+ 'scripts' => 'resources/src/mediawiki/mediawiki.ForeignStructuredUpload.js',
+ 'dependencies' => array(
+ 'mediawiki.ForeignUpload',
+ ),
+ ),
'mediawiki.Upload.Dialog' => array(
'scripts' => 'resources/src/mediawiki/mediawiki.Upload.Dialog.js',
'dependencies' => array(
),
'mediawiki.Uri' => array(
'scripts' => 'resources/src/mediawiki/mediawiki.Uri.js',
+ 'templates' => array(
+ 'strict.regexp' => 'resources/src/mediawiki/mediawiki.Uri.strict.regexp',
+ 'loose.regexp' => 'resources/src/mediawiki/mediawiki.Uri.loose.regexp',
+ ),
'dependencies' => 'mediawiki.util',
'targets' => array( 'desktop', 'mobile' ),
),
'styles' => 'resources/src/mediawiki.toolbar/toolbar.less',
'position' => 'top',
),
+ 'mediawiki.experiments' => array(
+ 'scripts' => 'resources/src/mediawiki/mediawiki.experiments.js',
+ 'targets' => array( 'desktop', 'mobile' ),
+ ),
/* MediaWiki Action */
'prefs-editing'
),
),
+ 'mediawiki.action.view.filepage' => array(
+ 'styles' => array(
+ 'resources/src/mediawiki.action/mediawiki.action.view.filepage.print.css' => array( 'media' => 'print' ),
+ 'resources/src/mediawiki.action/mediawiki.action.view.filepage.css',
+ ),
+ 'position' => 'top',
+ ),
/* MediaWiki Language */
'mediawiki.page.gallery' => array(
'scripts' => 'resources/src/mediawiki.page/mediawiki.page.gallery.js',
'dependencies' => array(
+ 'mediawiki.page.gallery.styles',
'jquery.throttle-debounce',
)
),
+ 'mediawiki.page.gallery.styles' => array(
+ 'styles' => array(
+ 'resources/src/mediawiki.page/mediawiki.page.gallery.print.css' => array( 'media' => 'print' ),
+ 'resources/src/mediawiki.page/mediawiki.page.gallery.css',
+ ),
+ 'position' => 'top',
+ 'targets' => array( 'desktop', 'mobile' ),
+ ),
'mediawiki.page.ready' => array(
'scripts' => 'resources/src/mediawiki.page/mediawiki.page.ready.js',
'dependencies' => array(
'mediawiki.legacy.commonPrint' => array(
'position' => 'top',
'styles' => array(
+ // @todo: Remove mediawiki.page.gallery when cache has cleared
+ 'resources/src/mediawiki.page/mediawiki.page.gallery.print.css' => array( 'media' => 'print' ),
+ // @todo: Remove mediawiki.action.view.filepage.print.css when cache has cleared
+ 'resources/src/mediawiki.action/mediawiki.action.view.filepage.print.css' => array( 'media' => 'print' ),
'resources/src/mediawiki.legacy/commonPrint.css' => array( 'media' => 'print' )
),
'group' => 'print',
'mediawiki.legacy.shared' => array(
'position' => 'top',
'styles' => array(
+ // @todo: Remove when mediawiki.page.gallery in cached html.
+ 'resources/src/mediawiki.page/mediawiki.page.gallery.css',
+ // @todo: Remove mediawiki.action.view.filepage.css
+ // and mediawiki.legacy/images/checker.png when cache has cleared
+ 'resources/src/mediawiki.action/mediawiki.action.view.filepage.css',
'resources/src/mediawiki.legacy/shared.css' => array( 'media' => 'screen' )
),
),
'resources/src/mediawiki.widgets/mw.widgets.CalendarWidget.js',
'resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js',
'resources/src/mediawiki.widgets/mw.widgets.NamespaceInputWidget.js',
+ 'resources/src/mediawiki.widgets/mw.widgets.ComplexNamespaceInputWidget.js',
'resources/src/mediawiki.widgets/mw.widgets.TitleInputWidget.js',
'resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js',
'resources/src/mediawiki.widgets/mw.widgets.UserInputWidget.js',
),
),
'dependencies' => array(
+ 'oojs-ui',
'mediawiki.widgets.styles',
- 'jquery.autoEllipsis',
+ // DateInputWidget
+ 'moment',
+ // TitleInputWidget
'mediawiki.Title',
'mediawiki.api',
- 'moment',
- 'oojs-ui',
+ 'jquery.byteLimit',
+ // TitleOptionWidget
+ 'jquery.autoEllipsis',
),
'messages' => array(
+ // DateInputWidget
'mw-widgets-dateinput-no-date',
'mw-widgets-dateinput-placeholder-day',
'mw-widgets-dateinput-placeholder-month',
+ // NamespaceInputWidget
+ 'blanknamespace',
+ 'namespacesall',
+ // TitleInputWidget
'mw-widgets-titleinput-description-new-page',
'mw-widgets-titleinput-description-redirect',
),
'mediawiki.widgets.styles' => array(
'skinStyles' => array(
'default' => array(
- 'resources/src/mediawiki.widgets/mw.widgets.NamespaceInputWidget.base.css',
+ 'resources/src/mediawiki.widgets/mw.widgets.ComplexNamespaceInputWidget.base.css',
),
),
'position' => 'top',
font-style: italic;
}
-/* Comment and username portions of RC entries */
+/* Comment portions of RC entries */
span.comment {
font-style: italic;
}
-span.changedby {
- font-size: 95%;
-}
-
/* Math */
.texvc {
direction: ltr;
clear: both;
}
-/**
- * File description page
- */
-
-div.mw-filepage-resolutioninfo {
- font-size: smaller;
-}
-
-/**
- * File histories
- */
-h2#filehistory {
- clear: both;
-}
-
-table.filehistory th,
-table.filehistory td {
- vertical-align: top;
-}
-
-table.filehistory th {
- text-align: left;
-}
-
-table.filehistory td.mw-imagepage-filesize,
-table.filehistory th.mw-imagepage-filesize {
- white-space: nowrap;
-}
-
-table.filehistory td.filehistory-selected {
- font-weight: bold;
-}
-
-/**
- * Add a checkered background image on hover for file
- * description pages. (bug 26470)
- */
-.filehistory a img,
-#file img:hover {
- /* @embed */
- background: white url(images/checker.png) repeat;
-}
-
/**
* rev_deleted stuff
*/
width: auto;
}
- .mw-icon-question {
- /* SVG support using a transparent gradient to guarantee cross-browser
- * compatibility (browsers able to understand gradient syntax support also SVG).
- * http://pauginer.tumblr.com/post/36614680636/invisible-gradient-technique */
- background-image: url(images/question.png);
- background-image: -webkit-linear-gradient(transparent, transparent), url(images/question.svg);
- background-image: linear-gradient(transparent, transparent), url(images/question.svg);
- background-repeat: no-repeat;
- background-size: 13px 13px;
- display: inline-block;
- height: 13px;
- width: 13px;
- margin-left: 4px;
- }
-
- .mw-icon-question:lang(ar),
- .mw-icon-question:lang(fa),
- .mw-icon-question:lang(ur) {
- -webkit-transform: scaleX(-1);
- -ms-transform: scaleX(-1);
- transform: scaleX(-1);
- }
-
td.mw-submit {
white-space: nowrap;
}
- table.mw-htmlform-nolabel td.mw-label {
- width: 1px;
- }
-
- tr.mw-htmlform-vertical-label td.mw-label {
- text-align: left !important;
- }
-
- .mw-htmlform-invalid-input td.mw-input input {
- border-color: red;
- }
-
- .mw-htmlform-flatlist div.mw-htmlform-flatlist-item {
- display: inline;
- margin-right: 1em;
- white-space: nowrap;
- }
-
- .mw-htmlform-matrix td {
- padding-left: 0.5em;
- padding-right: 0.5em;
- }
-
input#wpSummary {
width: 80%;
margin-bottom: 1em;
/* The auto-generated edit comments */
.autocomment {
color: gray;
- /* In RTL wikis, Latin heading sections can get jumbled with comments that
- begin with Latin letters or numbers */
- unicode-bidi: -moz-isolate;
- unicode-bidi: -webkit-isolate;
- unicode-bidi: isolate;
}
#pagehistory .history-user {
font-weight: bold;
}
-#shared-image-dup,
-#shared-image-conflict {
- font-style: italic;
-}
-
/**
* Recreating deleted page warning
* Reupload file warning
background-color: #eeeeff;
}
-/* filetoc */
-ul#filetoc {
- text-align: center;
- border: 1px solid #aaaaaa;
- background-color: #f9f9f9;
- padding: 5px;
- font-size: 95%;
- margin-bottom: 0.5em;
- margin-left: 0;
- margin-right: 0;
-}
-
-#filetoc li {
- display: inline;
- list-style-type: none;
- padding-right: 2em;
-}
-
/* Classes for Exif data display */
table.mw_metadata {
font-size: 0.8em;
margin-left: 0;
}
-/* Galleries */
-/* These display attributes look nonsensical, but are needed to support IE and FF2 */
-/* Don't forget to update commonPrint.css */
-li.gallerybox {
- vertical-align: top;
- display: -moz-inline-box;
- display: inline-block;
-}
-
-ul.gallery,
-li.gallerybox {
- zoom: 1;
- *display: inline;
-}
-
-ul.gallery {
- margin: 2px;
- padding: 2px;
- display: block;
-}
-
-li.gallerycaption {
- font-weight: bold;
- text-align: center;
- display: block;
- word-wrap: break-word;
-}
-
-li.gallerybox div.thumb {
- text-align: center;
- border: 1px solid #ccc;
- background-color: #f9f9f9;
- margin: 2px;
-}
-
-li.gallerybox div.thumb img {
- display: block;
- margin: 0 auto;
-}
-
-div.gallerytext {
- overflow: hidden;
- font-size: 94%;
- padding: 2px 4px;
- word-wrap: break-word;
-}
-
-/* new gallery stuff */
-ul.mw-gallery-nolines li.gallerybox div.thumb {
- background-color: transparent;
- border: none;
-}
-
-ul.mw-gallery-nolines li.gallerybox div.gallerytext {
- text-align: center;
-}
-
-/* height constrained gallery */
-
-ul.mw-gallery-packed li.gallerybox div.thumb,
-ul.mw-gallery-packed-overlay li.gallerybox div.thumb,
-ul.mw-gallery-packed-hover li.gallerybox div.thumb {
- background-color: transparent;
- border: none;
-}
-
-ul.mw-gallery-packed li.gallerybox div.thumb img,
-ul.mw-gallery-packed-overlay li.gallerybox div.thumb img,
-ul.mw-gallery-packed-hover li.gallerybox div.thumb img {
- margin: 0 auto;
-}
-
-ul.mw-gallery-packed-hover li.gallerybox,
-ul.mw-gallery-packed-overlay li.gallerybox {
- position: relative;
-}
-
-ul.mw-gallery-packed-hover div.gallerytextwrapper {
- overflow: hidden;
- height: 0;
-}
-
-ul.mw-gallery-packed-hover li.gallerybox:hover div.gallerytextwrapper,
-ul.mw-gallery-packed-overlay li.gallerybox div.gallerytextwrapper,
-ul.mw-gallery-packed-hover li.gallerybox.mw-gallery-focused div.gallerytextwrapper {
- position: absolute;
- background: white;
- background: rgba(255, 255, 255, 0.8);
- padding: 5px 10px;
- bottom: 0;
- left: 0; /* Needed for IE */
- height: auto;
- font-weight: bold;
- margin: 2px; /* correspond to style on div.thumb */
-}
-
-ul.mw-gallery-packed-hover,
-ul.mw-gallery-packed-overlay,
-ul.mw-gallery-packed {
- text-align: center;
-}
-
.mw-ajax-loader {
background-image: url(images/ajax-loader.gif);
background-position: center center;