Deprecate printableversion=yes

Replace the link to javascript:print() and add a warning message
on the printableversion when used.

The link is hidden if JS is not enabled and a skin includes the
'interface' ResourceLoaderSkinModule feature.

As part of this change we also need to notify users that
printableversion is no longer supported. To do this we need
to put a warningbox at the top of the page.

While this should be straightforward, as warning b ox styles
are loaded by all skins via the legacy module, it does require a minor
change to make those CSS rules apply inside print media as they are
currently scoped to screen. We rectify this, by splitting the rules
out from mediawiki.legacy.skinning and applying them to all media
queries. This means warning boxes will appear styled in print media
however these are seldom used in article namespaces - and when they are
they are visible - it would be better they look like warning boxes!

Bug: T167956
Change-Id: If1a3cfc6d82e9e389be7bf17fe288e212aa64139
This commit is contained in:
jdlrobson 2020-07-08 09:40:04 -07:00 committed by Jdlrobson
parent 8edc0973c5
commit 06cb860a72
9 changed files with 72 additions and 59 deletions

View file

@ -1388,6 +1388,7 @@ because of Phabricator reports.
replaced by rev_actor referencing actor.actor_id.
Note that archive.ar_user, archive.ar_user_text, and archive.ar_comment
had already been removed in previous releases.
* The printableversion has been marked as deprecated per T167956.
== Compatibility ==
MediaWiki 1.35 requires PHP 7.2.22 or later, and the following PHP extensions:

View file

@ -673,6 +673,11 @@ class Article implements Page {
if ( $outputPage->isPrintable() ) {
$parserOptions->setIsPrintable( true );
$poOptions['enableSectionEditLinks'] = false;
$outputPage->prependHTML(
Html::warningBox(
$outputPage->msg( 'printableversion-deprecated-warning' )->escaped()
)
);
} elseif ( $this->viewIsRenderAction || !$this->isCurrent() ||
!$this->permManager->quickUserCan( 'edit', $user, $this->getTitle() )
) {

View file

@ -101,6 +101,7 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
'screen' => [ 'resources/src/mediawiki.skinning/elements.css' ],
],
'legacy' => [
'all' => [ 'resources/src/mediawiki.skinning/messageBoxes.less' ],
'print' => [ 'resources/src/mediawiki.skinning/commonPrint.css' ],
'screen' => [ 'resources/src/mediawiki.skinning/legacy.less' ],
],

View file

@ -1479,8 +1479,7 @@ abstract class Skin extends ContextSource {
if ( !$out->isPrintable() && ( $out->isArticle() || $title->isSpecialPage() ) ) {
$nav_urls['print'] = [
'text' => $this->msg( 'printableversion' )->text(),
'href' => $title->getLocalURL(
$request->appendQueryValue( 'printable', 'yes' ) )
'href' => 'javascript:print();'
];
}

View file

@ -172,6 +172,7 @@
"history_small": "history",
"updatedmarker": "updated since your last visit",
"printableversion": "Printable version",
"printableversion-deprecated-warning": "The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.",
"permalink": "Permanent link",
"print": "Print",
"view": "View",

View file

@ -388,6 +388,7 @@
"history_small": "Uncapitalized version of {{msg-mw|History short}}.\n\n{{Identical|History}}",
"updatedmarker": "Displayed in the page history (of a page you are [[Special:Watchlist|watching]]), when the page has been edited since the last time you visited it. This feature is used if [[mw:Manual:$wgShowUpdatedMarker|$wgShowUpdatedMarker]] is enabled.",
"printableversion": "Display name for link in wiki menu that leads to a printable version of a content page. Example: see one but last menu item on [[Main Page]].\n\nSee also:\n* {{msg-mw|Printableversion}}\n* {{msg-mw|Accesskey-t-print}}\n* {{msg-mw|Tooltip-t-print}}\n{{Identical|Printable version}}",
"printableversion-deprecated-warning": "A warning that shows on printableversion=yes which makes clear this feature is deprecated.",
"permalink": "Display name for a permanent link to the current revision of a page. When the page is edited, permalink will still link to this revision. Example: Last menu link on [[{{MediaWiki:Mainpage}}]]\n\nSee also:\n* {{msg-mw|Permalink}}\n* {{msg-mw|Accesskey-t-permalink}}\n* {{msg-mw|Tooltip-t-permalink}}\n{{Identical|Permalink}}",
"print": "{{Identical|Print}}",
"view": "The default text of the \"View\" or \"Read\" (Vector) views tab which represents the basic view for the page. Should be in the infinitive mood.\n\n{{Identical|View}}",

View file

@ -69,3 +69,8 @@ textarea {
span.subpages {
display: block;
}
/* Hide links which require JavaScript to work */
.client-nojs #t-print {
display: none; /* T167956 */
}

View file

@ -372,63 +372,6 @@ a.new {
color: #14866d;
}
.messagebox,
.errorbox,
.warningbox,
.successbox {
color: #000;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin-bottom: 16px;
border: 1px solid;
padding: 12px 24px;
word-wrap: break-word;
/* Standard property is `overflow-wrap` */
overflow-wrap: break-word;
overflow: hidden;
}
/* Ensure box inner spacing is not all over the place no matter what element is only child. */
.messagebox :only-child,
.errorbox :only-child,
.warningbox :only-child,
.successbox :only-child {
margin: 0;
}
.messagebox h2,
.errorbox h2,
.warningbox h2,
.successbox h2 {
color: inherit;
display: inline;
margin: 0 0.5em 0 0;
border: 0;
font-size: 1em;
font-weight: bold;
}
.messagebox {
background-color: #eaecf0;
border-color: #a2a9b1;
}
.errorbox {
background-color: #fee7e6;
border-color: #d33;
}
.warningbox {
background-color: #fef6e7;
border-color: #fc3;
}
.successbox {
background-color: #d5fdf4;
border-color: #14866d;
}
/* general info/warning box for SP */
.mw-infobox {
border: 2px solid #fc3;

View file

@ -0,0 +1,57 @@
/* stylelint-disable selector-class-pattern */
.messagebox,
.errorbox,
.warningbox,
.successbox {
color: #000;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin-bottom: 16px;
border: 1px solid;
padding: 12px 24px;
word-wrap: break-word;
/* Standard property is `overflow-wrap` */
overflow-wrap: break-word;
overflow: hidden;
}
/* Ensure box inner spacing is not all over the place no matter what element is only child. */
.messagebox :only-child,
.errorbox :only-child,
.warningbox :only-child,
.successbox :only-child {
margin: 0;
}
.messagebox h2,
.errorbox h2,
.warningbox h2,
.successbox h2 {
color: inherit;
display: inline;
margin: 0 0.5em 0 0;
border: 0;
font-size: 1em;
font-weight: bold;
}
.messagebox {
background-color: #eaecf0;
border-color: #a2a9b1;
}
.errorbox {
background-color: #fee7e6;
border-color: #d33;
}
.warningbox {
background-color: #fef6e7;
border-color: #fc3;
}
.successbox {
background-color: #d5fdf4;
border-color: #14866d;
}