jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/379291 )

Change subject: Remove option to render books using OCG
......................................................................


Remove option to render books using OCG

Also, make sure the "Download as PDF" link doesn't trigger downloading
immediately, but rather takes the user to the Download screen.

Bug: T171956
Change-Id: I3b037b05bdab4cd821dcff25af597657f4c778ca
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/ext.ElectronPdfService.special.css
D modules/ext.ElectronPdfService.special.images.less
D modules/ext.ElectronPdfService.special.js
A resources/download-ltr.svg
A resources/download-rtl.svg
D resources/icons/check-invert.png
D resources/icons/check-invert.svg
D resources/selection-single-col-ltr.svg
D resources/selection-single-col-rtl.svg
D resources/selection-two-col-ltr.svg
D resources/selection-two-col-rtl.svg
M src/ElectronPdfServiceHooks.php
M src/specials/SpecialElectronPdf.php
A tests/browser/features/download_screen.feature
D tests/browser/features/selectionscreen.feature
A tests/browser/features/support/pages/download_screen_page.rb
D tests/browser/features/support/pages/selectionscreen_page.rb
A tests/browser/features/support/step_definitions/download_screen.rb
D tests/browser/features/support/step_definitions/selectionscreen.rb
22 files changed, 61 insertions(+), 373 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jdlrobson: Looks good to me, approved



diff --git a/extension.json b/extension.json
index 80a8415..a97d850 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
        "name": "ElectronPdfService",
-       "version": "0.0.1",
+       "version": "1.0.0",
        "author": [
                "TCB team (Wikimedia Deutschland)",
                "Tobias Gritschacher",
@@ -44,17 +44,6 @@
                                "modules/ext.ElectronPdfService.print.css"
                        ]
                },
-               "ext.ElectronPdfService.special": {
-                       "scripts": [
-                               "modules/ext.ElectronPdfService.special.js"
-                       ],
-                       "styles": [
-                               
"modules/ext.ElectronPdfService.special.images.less"
-                       ],
-                       "dependencies": [
-                               "ext.ElectronPdfService.special.selectionImages"
-                       ]
-               },
                "ext.ElectronPdfService.special.styles": {
                        "styles": [
                                "modules/ext.ElectronPdfService.special.css"
@@ -64,16 +53,10 @@
                        "class": "ResourceLoaderImageModule",
                        "selector": ".mw-electronPdfService-selection-{name}",
                        "images": {
-                               "single-column-image": {
+                               "download-image": {
                                        "file": {
-                                               "ltr": 
"resources/selection-single-col-ltr.svg",
-                                               "rtl": 
"resources/selection-single-col-rtl.svg"
-                                       }
-                               },
-                               "two-column-image": {
-                                       "file": {
-                                               "ltr": 
"resources/selection-two-col-ltr.svg",
-                                               "rtl": 
"resources/selection-two-col-rtl.svg"
+                                               "ltr": 
"resources/download-ltr.svg",
+                                               "rtl": 
"resources/download-rtl.svg"
                                        }
                                }
                        }
diff --git a/i18n/en.json b/i18n/en.json
index a9dd83e..99067c2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,11 +7,7 @@
        "electronPdfService": "ElectronPdfService",
        "electronPdfService-desc": "Adds browser based PDF rendering support 
through Electron PDF service",
        "electronPdfService-special-page-headline": "Download as PDF",
-       "electronPdfService-select-layout-header": "Select a layout",
-       "electronPdfService-single-column-label": "Single column",
-       "electronPdfService-two-column-label": "Two column",
-       "electronPdfService-single-column-desc": "Includes tables and 
infoboxes",
-       "electronPdfService-two-column-desc": "Without tables and infoboxes",
+       "electronPdfService-download-label": "Download as PDF",
        "electronPdfService-download-button": "Download",
        "electronPdfService-sidebar-portlet-heading": "Print/export",
        "electronPdfService-sidebar-portlet-print-text": "Download as PDF",
@@ -21,4 +17,4 @@
        "electronPDFService-warning-message": "We have technical problems with 
the function we use to create PDFs. We unfortunately have to replace it. This 
affects the styling and features of the books function. For more information 
and feedback, visit the 
[https://www.mediawiki.org/wiki/Reading/Web/PDF_Functionality project page].",
        "electronPDFService-warning-leave-feedback": "Leave feedback",
        "electronPDFService-warning-read-more": "Read more"
-}
\ No newline at end of file
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a0bb61b..a290376 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,11 +10,7 @@
        "electronPdfService": "electronPdfService",
        "electronPdfService-desc": "{{desc|name=ElectronPdfService|url=}}",
        "electronPdfService-special-page-headline": "Title for the special 
page.",
-       "electronPdfService-select-layout-header": "Header for layout 
selection.",
-       "electronPdfService-single-column-label": "Label for the single column 
option.",
-       "electronPdfService-two-column-label": "Label for the two column 
option.",
-       "electronPdfService-single-column-desc": "Short description for the 
single column option.",
-       "electronPdfService-two-column-desc": "Short description for the two 
column option.",
+       "electronPdfService-download-label": "Label that appears next to the 
the download image.",
        "electronPdfService-download-button": "Label for the download 
button.\n{{Identical|Download}}",
        "electronPdfService-sidebar-portlet-heading": "Title of the portlet in 
which the link is shown.\n\n{{Identical|Print/Export}}",
        "electronPdfService-sidebar-portlet-print-text": "Text of 
print-pdf-link in sidebar.",
diff --git a/modules/ext.ElectronPdfService.special.css 
b/modules/ext.ElectronPdfService.special.css
index f8d04e6..a9034e7 100644
--- a/modules/ext.ElectronPdfService.special.css
+++ b/modules/ext.ElectronPdfService.special.css
@@ -1,9 +1,3 @@
-.mw-electronPdfService-selection-header {
-       font-weight: bold;
-       font-size: 15px;
-       margin-bottom: 13px;
-}
-
 .mw-electronPdfService-selection-body {
        display: inline-block;
 }
@@ -17,7 +11,7 @@
 }
 
 .mw-electronPdfService-selection-label-text {
-       font-size: 13px;
+       font-size: 16px;
        font-weight: bold;
        padding-top: 9px;
 }
@@ -27,19 +21,10 @@
 }
 
 .mw-electronPdfService-selection-form label {
-       display: table-cell;
        border: 1px solid #c8ccd1;
-       padding: 15px;
-}
-
-.mw-electronPdfService-selection-form input[type='radio']:checked ~ b {
-       border: 1px solid #00f;
-}
-
-.mw-electronPdfService-selection-form label {
-       border: 1px solid #c8ccd1;
-       padding: 15px;
        color: #545454;
+       display: table-cell;
+       padding: 15px;
 }
 
 .mw-electronPdfService-selection-field {
@@ -52,25 +37,8 @@
        vertical-align: middle;
 }
 
-.mw-electronPdfService-selection-form .oo-ui-radioInputWidget {
-       margin-bottom: 5px;
-}
-
-label.mw-electronPdfService-selection-form-selected {
-       background-color: #eaf3ff;
-       border: 1px solid #36c;
-}
-
 .mw-electronPdfService-selection-form .oo-ui-buttonGroupWidget {
        display: block;
        margin-top: 15px;
        text-align: right;
-}
-
-/* normally there is no OOUI check icon for the radio box */
-.mw-electronPdfService-selection-form .oo-ui-radioInputWidget 
[type='radio']:checked + span {
-       background-size: 150%;
-       background-position: center;
-       background-color: #36c;
-       border-color: #36c;
 }
diff --git a/modules/ext.ElectronPdfService.special.images.less 
b/modules/ext.ElectronPdfService.special.images.less
deleted file mode 100644
index c526f13..0000000
--- a/modules/ext.ElectronPdfService.special.images.less
+++ /dev/null
@@ -1,8 +0,0 @@
-@import 'mediawiki.mixins';
-
-/* normally there is no OOUI check icon for the radio box */
-.mw-electronPdfService-selection-form .oo-ui-radioInputWidget 
[type='radio']:checked + span {
-       /* Hardcoded this to avoid adding a class with JS. images taken from:
-       
https://doc.wikimedia.org/oojs-ui/master/demos/dist/themes/mediawiki/images/icons/
 */
-       .background-image-svg( '../resources/icons/check-invert.svg', 
'../resources/icons/check-invert.png' );
-}
diff --git a/modules/ext.ElectronPdfService.special.js 
b/modules/ext.ElectronPdfService.special.js
deleted file mode 100644
index fc3090c..0000000
--- a/modules/ext.ElectronPdfService.special.js
+++ /dev/null
@@ -1,13 +0,0 @@
-$( function () {
-       function setSelected( $element ) {
-               $( '.mw-electronPdfService-selection-form label' ).removeClass( 
'mw-electronPdfService-selection-form-selected' );
-               $element.closest( 'label' ).addClass( 
'mw-electronPdfService-selection-form-selected' );
-               $element.blur();
-       }
-
-       setSelected( $( '.mw-electronPdfService-selection-form 
.oo-ui-radioInputWidget :checked' ) );
-
-       $( '.mw-electronPdfService-selection-form .oo-ui-radioInputWidget 
[type="radio"]' ).click( function () {
-               setSelected( $( this ) );
-       } );
-}() );
diff --git a/resources/download-ltr.svg b/resources/download-ltr.svg
new file mode 100644
index 0000000..6697b16
--- /dev/null
+++ b/resources/download-ltr.svg
@@ -0,0 +1 @@
+<svg width="85" height="101" viewBox="0 0 85 101" 
xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink";><title>Group 4</title><defs><rect 
id="b" width="79" height="95" rx="2"/><filter x="-50%" y="-50%" width="200%" 
height="200%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" 
in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur 
stdDeviation="1.5" in="shadowOffsetOuter1" 
result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0.213881341 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" 
fill-rule="evenodd"><g transform="translate(3 2)"><use fill="#000" 
filter="url(#a)" xlink:href="#b"/><use fill="#FFF" xlink:href="#b"/></g><g 
opacity=".8" fill="#C8CCD1"><path d="M10 32h65v2H10zM10 38h65v2H10zM10 
44h65v2H10zM10 80h65v2H10zM10 86h65v2H10z"/><path opacity=".5" d="M10 
50h65v26H10z"/><path d="M11 21h39v5H11z"/></g></g></svg>
\ No newline at end of file
diff --git a/resources/download-rtl.svg b/resources/download-rtl.svg
new file mode 100644
index 0000000..b3c1fc1
--- /dev/null
+++ b/resources/download-rtl.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="85" height="101" viewBox="0 0 
85 101"><title>Group 4</title><defs><rect id="a" width="79" height="95" 
rx="2"/><filter x="-50%" y="-50%" width="200%" height="200%" 
filterUnits="objectBoundingBox" id="b"><feOffset dy="1" in="SourceAlpha" 
result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="1.5" 
in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.213881341 0" 
in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><g 
transform="matrix(-1 0 0 1 82 2)"><use xlink:href="#a" width="100%" 
height="100%" fill="#000" filter="url(#b)"/><use xlink:href="#a" width="100%" 
height="100%" fill="#fff"/></g><g opacity=".8" fill="#c8ccd1"><path d="M75 
32H10v2h65zM75 38H10v2h65zM75 44H10v2h65zM75 80H10v2h65zM75 86H10v2h65z"/><path 
d="M75 50H10v26h65z" opacity=".5"/><path d="M74 21H35v5h39z"/></g></g></svg>
\ No newline at end of file
diff --git a/resources/icons/check-invert.png b/resources/icons/check-invert.png
deleted file mode 100644
index 708bb39..0000000
--- a/resources/icons/check-invert.png
+++ /dev/null
Binary files differ
diff --git a/resources/icons/check-invert.svg b/resources/icons/check-invert.svg
deleted file mode 100644
index b7a1be0..0000000
--- a/resources/icons/check-invert.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg"; width="24" height="24" viewBox="0 0 24 
24"><style>* { fill: #fff }</style>
-    <path d="M17 7.5L9.5 15 6 11.5 4.5 13l5 5L20 7.5c-.706-.706-2.294-.706-3 
0z" id="check"/>
-</svg>
diff --git a/resources/selection-single-col-ltr.svg 
b/resources/selection-single-col-ltr.svg
deleted file mode 100644
index 5cbbab6..0000000
--- a/resources/selection-single-col-ltr.svg
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg width="85" height="101" viewBox="0 0 85 101" 
xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";>
-    <title>
-        Group 4
-    </title>
-    <defs>
-        <rect id="path-1" width="79" height="95" rx="2"/>
-        <filter x="-50%" y="-50%" width="200%" height="200%" 
filterUnits="objectBoundingBox" id="filter-2">
-            <feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/>
-            <feGaussianBlur stdDeviation="1.5" in="shadowOffsetOuter1" 
result="shadowBlurOuter1"/>
-            <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0.213881341 0" in="shadowBlurOuter1"/>
-        </filter>
-    </defs>
-    <g id="Page-1" fill="none" fill-rule="evenodd">
-        <g id="tools-explained-copy-2" transform="translate(-518 -290)">
-            <g id="Group-8" transform="translate(504 276)">
-                <g id="Group-3" transform="translate(17 16)">
-                    <g id="Group-4">
-                        <g id="Rectangle-3">
-                            <use fill="#000" filter="url(#filter-2)" 
xlink:href="#path-1"/>
-                            <use fill="#FFF" xlink:href="#path-1"/>
-                        </g>
-                        <g id="Group-2" opacity=".8" transform="translate(7 
19)" fill="#C8CCD1">
-                            <path id="Rectangle-5-Copy" d="M0 11h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-2" d="M0 17h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-3" d="M0 23h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-16" d="M0 59h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-19" d="M0 65h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-15" opacity=".5" d="M0 
29h65v26H0z"/>
-                            <path id="Rectangle-5" d="M1 0h39v5H1z"/>
-                        </g>
-                    </g>
-                </g>
-            </g>
-        </g>
-    </g>
-</svg>
diff --git a/resources/selection-single-col-rtl.svg 
b/resources/selection-single-col-rtl.svg
deleted file mode 100644
index a8a4303..0000000
--- a/resources/selection-single-col-rtl.svg
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="85" height="101" viewBox="0 0 
85 101" id="svg2">
-    <title id="title4">
-        Group 4
-    </title>
-    <defs id="defs6">
-        <rect id="path-1" width="79" height="95" rx="2"/>
-        <filter x="-50%" y="-50%" width="200%" height="200%" 
filterUnits="objectBoundingBox" id="filter-2">
-            <feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1" 
id="feOffset10"/>
-            <feGaussianBlur stdDeviation="1.5" in="shadowOffsetOuter1" 
result="shadowBlurOuter1" id="feGaussianBlur12"/>
-            <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0.213881341 0" in="shadowBlurOuter1" id="feColorMatrix14"/>
-        </filter>
-    </defs>
-    <g id="Page-1" transform="matrix(-1 0 0 1 85 0)" fill="none" 
fill-rule="evenodd">
-        <g id="tools-explained-copy-2" transform="translate(-518 -290)">
-            <g id="Group-8" transform="translate(504 276)">
-                <g id="Group-3" transform="translate(17 16)">
-                    <g id="Group-4">
-                        <g id="Rectangle-3">
-                            <use xlink:href="#path-1" id="use22" width="100%" 
height="100%" fill="#000" filter="url(#filter-2)"/>
-                            <use xlink:href="#path-1" id="use24" width="100%" 
height="100%" fill="#fff"/>
-                        </g>
-                        <g id="Group-2" transform="translate(7 19)" 
opacity=".8" fill="#c8ccd1">
-                            <path id="Rectangle-5-Copy" d="M0 11h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-2" d="M0 17h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-3" d="M0 23h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-16" d="M0 59h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-19" d="M0 65h65v2H0z"/>
-                            <path id="Rectangle-5-Copy-15" d="M0 29h65v26H0z" 
opacity=".5"/>
-                            <path id="Rectangle-5" d="M1 0h39v5H1z"/>
-                        </g>
-                    </g>
-                </g>
-            </g>
-        </g>
-    </g>
-</svg>
diff --git a/resources/selection-two-col-ltr.svg 
b/resources/selection-two-col-ltr.svg
deleted file mode 100644
index d67711b..0000000
--- a/resources/selection-two-col-ltr.svg
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg width="85" height="101" viewBox="0 0 85 101" 
xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";>
-    <title>
-        Group 9
-    </title>
-    <defs>
-        <rect id="path-1" width="79" height="95" rx="2"/>
-        <filter x="-50%" y="-50%" width="200%" height="200%" 
filterUnits="objectBoundingBox" id="filter-2">
-            <feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/>
-            <feGaussianBlur stdDeviation="1.5" in="shadowOffsetOuter1" 
result="shadowBlurOuter1"/>
-            <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0.213881341 0" in="shadowBlurOuter1"/>
-        </filter>
-    </defs>
-    <g id="Page-1" fill="none" fill-rule="evenodd">
-        <g id="tools-explained-copy-2" transform="translate(-823 -290)">
-            <g id="Group-7" transform="translate(805 276)">
-                <g id="Group-9" transform="translate(21 16)">
-                    <g id="Rectangle-3">
-                        <use fill="#000" filter="url(#filter-2)" 
xlink:href="#path-1"/>
-                        <use fill="#FFF" xlink:href="#path-1"/>
-                    </g>
-                    <g id="Group-2" opacity=".8" transform="translate(9 19)" 
fill="#C8CCD1">
-                        <path id="Rectangle-5" d="M0 0h39v5H0z"/>
-                        <g id="Group-5" transform="translate(1 16)">
-                            <path id="Rectangle-5-Copy" d="M0 0h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-2" d="M0 
7h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-3" d="M0 
14h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-17" d="M0 
21h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-18" d="M0 
28h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-25" d="M0 
35h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-26" d="M0 
42h26.329v2H0z"/>
-                        </g>
-                        <g id="Group-5-Copy" transform="translate(33 16)">
-                            <path id="Rectangle-5-Copy" d="M0 0h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-2" d="M0 
7h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-3" d="M0 
14h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-17" d="M0 
21h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-18" d="M0 
28h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-25" d="M0 
35h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-26" d="M0 
42h26.329v2H0z"/>
-                        </g>
-                    </g>
-                </g>
-            </g>
-        </g>
-    </g>
-</svg>
diff --git a/resources/selection-two-col-rtl.svg 
b/resources/selection-two-col-rtl.svg
deleted file mode 100644
index fde68ac..0000000
--- a/resources/selection-two-col-rtl.svg
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="85" height="101" viewBox="0 0 
85 101" id="svg2">
-    <title id="title4">
-        Group 9
-    </title>
-    <defs id="defs6">
-        <rect id="path-1" width="79" height="95" rx="2"/>
-        <filter x="-50%" y="-50%" width="200%" height="200%" 
filterUnits="objectBoundingBox" id="filter-2">
-            <feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1" 
id="feOffset10"/>
-            <feGaussianBlur stdDeviation="1.5" in="shadowOffsetOuter1" 
result="shadowBlurOuter1" id="feGaussianBlur12"/>
-            <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0.213881341 0" in="shadowBlurOuter1" id="feColorMatrix14"/>
-        </filter>
-    </defs>
-    <g id="Page-1" transform="matrix(-1 0 0 1 85 0)" fill="none" 
fill-rule="evenodd">
-        <g id="tools-explained-copy-2" transform="translate(-823 -290)">
-            <g id="Group-7" transform="translate(805 276)">
-                <g id="Group-9" transform="translate(21 16)">
-                    <g id="Rectangle-3">
-                        <use xlink:href="#path-1" id="use21" width="100%" 
height="100%" fill="#000" filter="url(#filter-2)"/>
-                        <use xlink:href="#path-1" id="use23" width="100%" 
height="100%" fill="#fff"/>
-                    </g>
-                    <g id="Group-2" transform="translate(9 19)" opacity=".8" 
fill="#c8ccd1">
-                        <path id="Rectangle-5" d="M0 0h39v5H0z"/>
-                        <g id="Group-5" transform="translate(1 16)">
-                            <path id="Rectangle-5-Copy" d="M0 0h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-2" d="M0 
7h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-3" d="M0 
14h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-17" d="M0 
21h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-18" d="M0 
28h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-25" d="M0 
35h26.329v2H0z"/>
-                            <path id="Rectangle-5-Copy-26" d="M0 
42h26.329v2H0z"/>
-                        </g>
-                        <g id="Group-5-Copy" transform="translate(33 16)">
-                            <path id="path36" d="M0 0h26.329v2H0z"/>
-                            <path id="path38" d="M0 7h26.329v2H0z"/>
-                            <path id="path40" d="M0 14h26.329v2H0z"/>
-                            <path id="path42" d="M0 21h26.329v2H0z"/>
-                            <path id="path44" d="M0 28h26.329v2H0z"/>
-                            <path id="path46" d="M0 35h26.329v2H0z"/>
-                            <path id="path48" d="M0 42h26.329v2H0z"/>
-                        </g>
-                    </g>
-                </g>
-            </g>
-        </g>
-    </g>
-</svg>
diff --git a/src/ElectronPdfServiceHooks.php b/src/ElectronPdfServiceHooks.php
index 581090b..e470c1d 100644
--- a/src/ElectronPdfServiceHooks.php
+++ b/src/ElectronPdfServiceHooks.php
@@ -12,8 +12,8 @@
 class ElectronPdfServiceHooks {
 
        /**
-        * If present, make the "Download as PDF" link in the sidebar point to 
the selection screen,
-        * add a new link otherwise
+        * If present, make the "Download as PDF" link in the sidebar point to 
the download screen,
+        * add a new link otherwise.
         *
         * @param Skin $skin
         * @param mixed &$bar
@@ -31,31 +31,32 @@
                        return true;
                }
 
+               // FIXME: remove logic related to Extension:Collection once we 
decommission it: T176755.
                if ( $config->has( 'CollectionFormats' ) && array_key_exists( 
'coll-print_export', $bar ) ) {
                        $index = self::getIndexOfDownloadPdfSidebarItem(
                                $bar['coll-print_export'],
                                $config->get( 'CollectionFormats' )
                        );
-                       // if Collection extension provides a download-as-pdf 
link, make it point to the selection screen
+                       // if Collection extension provides a download-as-pdf 
link, make it point to the download screen
                        if ( $index !== false ) {
-                               $bar['coll-print_export'][$index]['href'] = 
self::generateSelectionScreenLink(
-                                       $title,
-                                       
$bar['coll-print_export'][$index]['href']
+                               $bar['coll-print_export'][$index]['href'] = 
self::generateDownloadScreenLink(
+                                       $title
                                );
-                       // if no download-as-pdf link is there, add one and 
point to the selection screen
+                       // if no download-as-pdf link is there, add one and 
point to the download screen
                        } else {
                                $bar['coll-print_export'][] = [
                                        'text' => $skin->msg( 
'electronPdfService-sidebar-portlet-print-text' ),
                                        'id' => 'electron-print_pdf',
-                                       'href' => 
self::generatePdfDownloadLink( $title )
+                                       'href' => 
self::generateDownloadScreenLink( $title )
                                ];
                        }
                } else {
-                       // in case Collection is not installed, let's add our 
own portlet with a direct link to the PDF
+                       // in case Collection is not installed, let's add our 
own portlet
+                       // with a link to the download screen
                        $bar['electronPdfService-sidebar-portlet-heading'][] = [
                                'text' => $skin->msg( 
'electronPdfService-sidebar-portlet-print-text' ),
                                'id' => 'electron-print_pdf',
-                               'href' => self::generatePdfDownloadLink( $title 
)
+                               'href' => self::generateDownloadScreenLink( 
$title )
                        ];
                }
 
@@ -98,14 +99,13 @@
                );
        }
 
-       private static function generateSelectionScreenLink( Title $title, 
$collectionUrl ) {
+       private static function generateDownloadScreenLink( Title $title ) {
                $specialPageTitle = SpecialPage::getTitleFor( 'ElectronPdf' );
 
                return $specialPageTitle->getLocalURL(
                        [
                                'page' => $title->getPrefixedText(),
-                               'action' => 'show-selection-screen',
-                               'coll-download-url' => $collectionUrl
+                               'action' => 'show-download-screen'
                        ]
                );
        }
diff --git a/src/specials/SpecialElectronPdf.php 
b/src/specials/SpecialElectronPdf.php
index 193240b..1517834 100644
--- a/src/specials/SpecialElectronPdf.php
+++ b/src/specials/SpecialElectronPdf.php
@@ -27,9 +27,6 @@
                $request = $this->getRequest();
                $parts = ( $subPage === '' ) ? [] : explode( '/', $subPage, 2 );
                $page = trim( $request->getVal( 'page', isset( $parts[0] ) ? 
$parts[0] : '' ) );
-               $collectionDownloadUrl = trim(
-                       $request->getVal( 'coll-download-url', isset( $parts[0] 
) ? $parts[0] : '' )
-               );
 
                $title = Title::newFromText( $page );
                if ( $title === null ) {
@@ -50,23 +47,17 @@
                                $stats->increment( 
'electronpdf.actionsPerWiki.' . $dbName . '.' .  $action );
                                $this->redirectToElectron( $title );
                                return;
-                       case 'redirect-to-collection':
-                               $stats->increment( 'electronpdf.action.' . 
$action );
-                               $stats->increment( 
'electronpdf.actionsPerWiki.' . $dbName . '.' .  $action );
-                               $this->redirectToCollection( 
$collectionDownloadUrl );
-                               return;
                        default:
-                               $stats->increment( 
'electronpdf.action.show-selection-screen' );
-                               $stats->increment( 
'electronpdf.actionsPerWiki.' . $dbName . '.show-selection-screen' );
-                               $this->showRenderModeSelectionPage( $title, 
$collectionDownloadUrl );
+                               $stats->increment( 
'electronpdf.action.show-download-screen' );
+                               $stats->increment( 
'electronpdf.actionsPerWiki.' . $dbName . '.show-download-screen' );
+                               $this->showRenderModeSelectionPage( $title );
                }
        }
 
        /**
         * @param Title $title page to download as PDF
-        * @param string $collectionDownloadUrl URL to the download page of the 
Collection extension
         */
-       public function showRenderModeSelectionPage( Title $title, 
$collectionDownloadUrl ) {
+       public function showRenderModeSelectionPage( Title $title ) {
                $this->setHeaders();
 
                $out = $this->getOutput();
@@ -83,15 +74,10 @@
 
                $form->appendContent(
                        ( new OOUI\Tag() )
-                               ->addClasses( [ 
'mw-electronPdfService-selection-header' ] )
-                               ->appendContent( $this->msg( 
'electronPdfService-select-layout-header' )->text() ),
-                       ( new OOUI\Tag() )
                                ->addClasses( [ 
'mw-electronPdfService-selection-body' ] )
                                ->appendContent(
-                                       $this->getLabeledOptionField( 
'redirect-to-electron', 'single', true ),
-                                       $this->getLabeledOptionField( 
'redirect-to-collection', 'two' ),
+                                       $this->getLabeledHiddenField( 
'redirect-to-electron',  $title->getDBKey() ),
                                        $this->getHiddenField( 'page', 
$title->getPrefixedText() ),
-                                       $this->getHiddenField( 
'coll-download-url', $collectionDownloadUrl ),
                                        new OOUI\ButtonGroupWidget( [
                                                'items' => [
                                                        new 
OOUI\ButtonInputWidget( [
@@ -109,27 +95,22 @@
 
        /**
         * @param string $action
-        * @param string $name
-        * @param boolean $selected
+        * @param string $pageTitle
         * @return OOUI\Tag
         */
-       private function getLabeledOptionField( $action, $name, $selected = 
false ) {
+       private function getLabeledHiddenField( $action, $pageTitle ) {
                $image = ( new OOUI\Tag() )->addClasses( [
                        'mw-electronPdfService-selection-image',
-                       'mw-electronPdfService-selection-' . $name . 
'-column-image'
+                       'mw-electronPdfService-selection-download-image'
                ] );
 
                $field = ( new OOUI\Tag() )->addClasses( [ 
'mw-electronPdfService-selection-field' ] );
                $field->appendContent(
-                       new OOUI\RadioInputWidget( [
-                               'name' => 'action',
-                               'value' => $action,
-                               'selected' => $selected
-                       ] ),
+                       $this->getHiddenField( 'action', $action ),
                        ( new OOUI\Tag( 'div' ) )->addClasses( [ 
'mw-electronPdfService-selection-label-text' ] )
-                               ->appendContent( $this->msg( 
'electronPdfService-' . $name . '-column-label' )->text() ),
+                               ->appendContent( $this->msg( 
'electronPdfService-download-label' )->text() ),
                        ( new OOUI\Tag( 'div' ) )->addClasses( [ 
'mw-electronPdfService-selection-label-desc' ] )
-                               ->appendContent( $this->msg( 
'electronPdfService-' . $name . '-column-desc' )->text() )
+                               ->appendContent( $pageTitle . ".pdf" )
                );
 
                $labelBox = ( new OOUI\Tag( 'label' ) )->appendContent(
@@ -208,19 +189,14 @@
        }
 
        /**
-        * Adds JS and CSS modules
+        * Adds CSS modules
         */
        protected function addModules() {
-               $out = $this->getOutput();
-               $rl = $out->getResourceLoader();
-
-               if (
-                       $rl->isModuleRegistered( 
'ext.ElectronPdfService.special.styles' )
-                       && $rl->isModuleRegistered( 
'ext.ElectronPdfService.special' )
-               ) {
-                       $out->addModuleStyles( [ 
'ext.ElectronPdfService.special.styles', 'mediawiki.hlist' ] );
-                       $out->addModules( 'ext.ElectronPdfService.special' );
-               }
+               $this->getOutput()->addModuleStyles( [
+                       'ext.ElectronPdfService.special.styles',
+                       'ext.ElectronPdfService.special.selectionImages',
+                       'mediawiki.hlist'
+               ] );
        }
 
        /**
@@ -240,22 +216,5 @@
                $this->getOutput()->redirect(
                        $this->getServiceUrl( $title )
                );
-       }
-
-       /**
-        * @param string $collectionDownloadUrl
-        */
-       private function redirectToCollection( $collectionDownloadUrl ) {
-               $queryString = parse_url(
-                       urldecode( $collectionDownloadUrl ),
-                       PHP_URL_QUERY
-               );
-               parse_str( $queryString, $params );
-               unset( $params['title'] );
-
-               $this->getOutput()->redirect( wfAppendQuery(
-                       SkinTemplate::makeSpecialUrl( 'Book' ),
-                       http_build_query( $params )
-               ) );
        }
 }
diff --git a/tests/browser/features/download_screen.feature 
b/tests/browser/features/download_screen.feature
new file mode 100644
index 0000000..2761daf
--- /dev/null
+++ b/tests/browser/features/download_screen.feature
@@ -0,0 +1,8 @@
+@chrome @en.wikipedia.beta.wmflabs.org @firefox @integration
+Feature: ElectronPdfService Download Screen
+  Background:
+    Given I am on the Main Page
+
+  Scenario: Download screen is shown with correct data
+    When I click Download as PDF
+    Then I should see the Download button
diff --git a/tests/browser/features/selectionscreen.feature 
b/tests/browser/features/selectionscreen.feature
deleted file mode 100644
index 1998194..0000000
--- a/tests/browser/features/selectionscreen.feature
+++ /dev/null
@@ -1,11 +0,0 @@
-@chrome @en.wikipedia.beta.wmflabs.org @firefox @integration
-Feature: ElectronPdfService Selection Screen
-  Background:
-    Given I am on the Main Page
-
-  Scenario: Selection screen is shown with correct default selection
-    When I click Download as PDF
-    Then Selection screen header should be there
-    And Selection elements should be there
-    And Download button should be there
-    And Single column option should be selected
diff --git a/tests/browser/features/support/pages/download_screen_page.rb 
b/tests/browser/features/support/pages/download_screen_page.rb
new file mode 100644
index 0000000..06a0d9b
--- /dev/null
+++ b/tests/browser/features/support/pages/download_screen_page.rb
@@ -0,0 +1,6 @@
+class DownloadScreenPage
+  include PageObject
+
+  hidden_field(:redirect_to_electron_action, css: 
'.mw-electronPdfService-selection-form [value=redirect-to-electron]')
+  button(:pdf_download_button, css: '.mw-electronPdfService-selection-form 
.oo-ui-buttonElement-button')
+end
diff --git a/tests/browser/features/support/pages/selectionscreen_page.rb 
b/tests/browser/features/support/pages/selectionscreen_page.rb
deleted file mode 100644
index d2a1be0..0000000
--- a/tests/browser/features/support/pages/selectionscreen_page.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class SelectionScreenPage
-  include PageObject
-
-  div(:selectionscreen_header, css: '.mw-electronPdfService-selection-header')
-  radio_button(:singlecolumn_selection, css: 
'.mw-electronPdfService-selection-form [value=redirect-to-electron]')
-  radio_button(:twocolumn_selection, css: 
'.mw-electronPdfService-selection-form [value=redirect-to-collection]')
-  button(:pdf_download_button, css: '.mw-electronPdfService-selection-form 
.oo-ui-buttonElement-button')
-end
diff --git a/tests/browser/features/support/step_definitions/download_screen.rb 
b/tests/browser/features/support/step_definitions/download_screen.rb
new file mode 100644
index 0000000..c51d884
--- /dev/null
+++ b/tests/browser/features/support/step_definitions/download_screen.rb
@@ -0,0 +1,5 @@
+Then(/^I should see the Download button$/) do
+  on(DownloadScreenPage) do |page|
+    expect(page.pdf_download_button_element).to be_visible
+  end
+end
diff --git a/tests/browser/features/support/step_definitions/selectionscreen.rb 
b/tests/browser/features/support/step_definitions/selectionscreen.rb
deleted file mode 100644
index ef05438..0000000
--- a/tests/browser/features/support/step_definitions/selectionscreen.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-Then(/^Selection screen header should be there$/) do
-  expect(on(SelectionScreenPage).selectionscreen_header_element).to be_visible
-end
-
-Then(/^Selection elements should be there$/) do
-  on(SelectionScreenPage) do |page|
-    expect(page.singlecolumn_selection_element.exists?).to be true
-    expect(page.twocolumn_selection_element.exists?).to be true
-  end
-end
-
-Then(/^Download button should be there$/) do
-  on(SelectionScreenPage) do |page|
-    expect(page.pdf_download_button_element).to be_visible
-  end
-end
-
-Then(/^Single column option should be selected$/) do
-  on(SelectionScreenPage) do |page|
-    expect(page.singlecolumn_selection_element.attribute('checked')).to 
be_truthy
-    expect(page.twocolumn_selection_element.attribute('checked')).to be_falsey
-  end
-end

-- 
To view, visit https://gerrit.wikimedia.org/r/379291
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b037b05bdab4cd821dcff25af597657f4c778ca
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/ElectronPdfService
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Andrew-WMDE <andrew.kos...@wikimedia.de>
Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Pmiazga <pmia...@wikimedia.org>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: WMDE-Fisch <christoph.jau...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to