From fc7369835258467bf97eb64f184b93691f9a9fd5 Mon Sep 17 00:00:00 2001 From: Yaco Date: Thu, 4 Jun 2020 11:01:00 -0300 Subject: first commit --- www/wiki/mw-config/config-cc.css | 60 +++++++ www/wiki/mw-config/config.css | 209 ++++++++++++++++++++++ www/wiki/mw-config/config.js | 151 ++++++++++++++++ www/wiki/mw-config/images/ajax-loader.gif | Bin 0 -> 1788 bytes www/wiki/mw-config/images/bullet.gif | Bin 0 -> 50 bytes www/wiki/mw-config/images/critical-32.png | Bin 0 -> 1736 bytes www/wiki/mw-config/images/download-32.png | Bin 0 -> 1717 bytes www/wiki/mw-config/images/help-question-hover.gif | Bin 0 -> 1246 bytes www/wiki/mw-config/images/help-question.gif | Bin 0 -> 126 bytes www/wiki/mw-config/images/info-32.png | Bin 0 -> 1832 bytes www/wiki/mw-config/images/installer-logo.png | Bin 0 -> 15448 bytes www/wiki/mw-config/images/tick-32.png | Bin 0 -> 1069 bytes www/wiki/mw-config/images/warning-32.png | Bin 0 -> 1268 bytes www/wiki/mw-config/index.php | 82 +++++++++ www/wiki/mw-config/overrides/README | 22 +++ 15 files changed, 524 insertions(+) create mode 100644 www/wiki/mw-config/config-cc.css create mode 100644 www/wiki/mw-config/config.css create mode 100644 www/wiki/mw-config/config.js create mode 100644 www/wiki/mw-config/images/ajax-loader.gif create mode 100644 www/wiki/mw-config/images/bullet.gif create mode 100644 www/wiki/mw-config/images/critical-32.png create mode 100644 www/wiki/mw-config/images/download-32.png create mode 100644 www/wiki/mw-config/images/help-question-hover.gif create mode 100644 www/wiki/mw-config/images/help-question.gif create mode 100644 www/wiki/mw-config/images/info-32.png create mode 100644 www/wiki/mw-config/images/installer-logo.png create mode 100644 www/wiki/mw-config/images/tick-32.png create mode 100644 www/wiki/mw-config/images/warning-32.png create mode 100644 www/wiki/mw-config/index.php create mode 100644 www/wiki/mw-config/overrides/README (limited to 'www/wiki/mw-config') diff --git a/www/wiki/mw-config/config-cc.css b/www/wiki/mw-config/config-cc.css new file mode 100644 index 00000000..3b2798fc --- /dev/null +++ b/www/wiki/mw-config/config-cc.css @@ -0,0 +1,60 @@ +/** + * Copy of CC standard stylesheet, plus tweaks for iframe usage + */ + +body { + margin: 0; + background: #eee; + font-family: 'Verdana'; + color: #333; +} + +#main { + border: 1px solid #d0d0d0; + background: #fff; + margin: 0.5em; +} + +/** + * Looks like you have to specify the width of #menu + * or IE5 Mac stretches it all the way across the div, and + * Opera streches it half way. + */ + +#main #menu { + border-left: 1px dotted #ccc; + float: right; + width: 230px; + background: #fff; + margin: 0 0 10px 10px; +} + +h1, +h3, +p, +pre, +td { + margin: 0 20px 20px 20px; + font-size: 11px; + line-height: 140%; +} + +.header { + padding-left: 10px; + padding-top: 10px; +} + +.nav { + padding-left: 10px; + padding-bottom: 10px; + font-size: 11px; + margin-bottom: 16px; +} + +#menu p { + font-size: 11px; +} + +.dent { + margin-left: 64px; +} diff --git a/www/wiki/mw-config/config.css b/www/wiki/mw-config/config.css new file mode 100644 index 00000000..2468c715 --- /dev/null +++ b/www/wiki/mw-config/config.css @@ -0,0 +1,209 @@ +.env-check { + font-size: 90%; + margin: 1em 0 1em 2.5em; +} + +.config-section { + margin-top: 2em; +} + +.config-block { + margin-top: 2em; + display: block; + +} + +.config-block-label { + display: block; + margin-bottom: 0.2em; +} + +.config-block-label label, +.config-label { + font-weight: bold; + padding-right: 0.5em; + padding-top: 0.2em; +} + +.config-block-elements { + margin-left: 2em; +} + +.config-block-elements li { + list-style: none; +} + +.config-input { + clear: left; + zoom: 100%; /* IE hack */ +} + +.config-page-wrapper { + padding: 0.5em; +} + +.config-page-list { + float: right; + width: 12em; + border: 1px solid #aaa; + background: #fff; + padding: 0.5em; + /* 3em left margin to leave space between the list and the page-content */ + margin: 0.5em 0.5em 0.5em 3.5em; +} + +.config-page { + padding: 0.5em 0.5em 0.5em 2em; + margin: 0.5em 0.5em 0.5em 0.5em; + background: #eee; +} + +.config-submit { + clear: left; + text-align: center; + padding: 1em; +} + +.config-submit input { + margin-left: 0.5em; + margin-right: 0.5em; +} + +.config-page-disabled { + color: #aaa; +} + +.config-error-box { + border: 2px solid #f00; +} + +.config-page-current { + font-weight: bold; +} + +.config-message { + display: list-item; + line-height: 1.5em; + /* @embed */ + list-style-image: url( images/bullet.gif ); + list-style-type: square; +} + +.config-input-text { + width: 20em; + margin-right: 1em; +} + +.config-input-check { + margin-left: 10em; +} + +.config-skins-item { + /* Clearfix */ + clear: left; + overflow: hidden; +} + +.config-skins-item .config-input-check { + margin-left: 10em; + width: 20em; + float: left; +} + +.config-skins-item .config-skins-use-as-default { + float: left; +} + +.error { + color: #f00; + background-color: #fff; + font-weight: bold; + left: 1em; + font-size: 100%; +} + +.config-settings-block { + list-style-type: none; + list-style-image: none; + margin: 0; + padding: 0; +} + +.btn-install { + font-weight: bold; + font-size: 110%; + padding: 0.2em 0.3em; +} + +.success-message { + font-weight: bold; + font-size: 110%; + color: #008000; +} + +.success-box { + font-size: 130%; +} + +.config-cc-wrapper { + clear: left; + /* If you change this height, also change it in WebInstallerOptions::submitCC() */ + height: 54em; +} + +.config-plainlink a { + background: none !important; /* stylelint-disable-line declaration-no-important */ + padding: 0 !important; /* stylelint-disable-line declaration-no-important */ +} + +.config-download-link { + font-size: 1.8em; + margin-left: 2em; +} + +.config-download-link a { + background: url( images/download-32.png ) no-repeat center left; + padding-left: 40px; /* 32 px for the image (above), plus some breathing room */ + height: 32px; /* provide enough vertical room for the image */ + display: inline-block; /* allow the height property (above) to work */ + line-height: 32px; /* center the text vertically */ +} + +#config-live-log { + overflow: hidden; + min-width: 20em; +} + +/* Hide empty live-log textarea */ +#config-live-log textarea:empty { + display: none; +} + +/* tooltip styles */ +.config-help-field-hint { + display: none; + margin-left: 2px; + margin-bottom: -8px; + padding: 0 0 0 15px; + /* @embed */ + background-image: url( images/help-question.gif ); + background-position: left center; + background-repeat: no-repeat; + cursor: pointer; + font-size: 0.8em; + text-decoration: underline; + color: #0645ad; +} + +.config-help-field-hint:hover { + /* @embed */ + background-image: url( images/help-question-hover.gif ); +} + +.config-help-field-data { + display: block; + background-color: #d6f3ff; + padding: 5px 8px 4px 8px; + border: 1px solid #5dc9f4; + margin-left: 20px; +} diff --git a/www/wiki/mw-config/config.js b/www/wiki/mw-config/config.js new file mode 100644 index 00000000..99290f44 --- /dev/null +++ b/www/wiki/mw-config/config.js @@ -0,0 +1,151 @@ +/* global extDependencyMap */ +( function ( $ ) { + $( function () { + var $label, labelText; + + function syncText() { + var value = $( this ).val() + .replace( /[\[\]{}|#<>%+? ]/g, '_' ) // eslint-disable-line no-useless-escape + .replace( /&/, '&' ) + .replace( /__+/g, '_' ) + .replace( /^_+/, '' ) + .replace( /_+$/, '' ); + value = value.charAt( 0 ).toUpperCase() + value.slice( 1 ); + $label.text( labelText.replace( '$1', value ) ); + } + + // Set up the help system + $( '.config-help-field-data' ).hide() + .closest( '.config-help-field-container' ).find( '.config-help-field-hint' ) + .show() + .click( function () { + $( this ).closest( '.config-help-field-container' ).find( '.config-help-field-data' ) + .slideToggle( 'fast' ); + } ); + + // Show/hide code for DB-specific options + // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? + $( '.dbRadio' ).each( function () { + $( document.getElementById( $( this ).attr( 'rel' ) ) ).hide(); + } ); + $( document.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show(); + $( '.dbRadio' ).click( function () { + var $checked = $( '.dbRadio:checked' ), + $wrapper = $( document.getElementById( $checked.attr( 'rel' ) ) ); + if ( $wrapper.is( ':hidden' ) ) { + $( '.dbWrapper' ).hide( 'slow' ); + $wrapper.show( 'slow' ); + } + } ); + + // Scroll to the bottom of upgrade log + $( '#config-live-log' ).children( 'textarea' ).each( function () { + this.scrollTop = this.scrollHeight; + } ); + + // Show/hide Creative Commons thingy + $( '.licenseRadio' ).click( function () { + var $wrapper = $( '#config-cc-wrapper' ); + if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) { + $wrapper.show( 'slow' ); + } else { + $wrapper.hide( 'slow' ); + } + } ); + + // Show/hide random stuff (email, upload) + $( '.showHideRadio' ).click( function () { + var $wrapper = $( '#' + $( this ).attr( 'rel' ) ); + if ( $( this ).is( ':checked' ) ) { + $wrapper.show( 'slow' ); + } else { + $wrapper.hide( 'slow' ); + } + } ); + $( '.hideShowRadio' ).click( function () { + var $wrapper = $( '#' + $( this ).attr( 'rel' ) ); + if ( $( this ).is( ':checked' ) ) { + $wrapper.hide( 'slow' ); + } else { + $wrapper.show( 'slow' ); + } + } ); + + // Hide "other" textboxes by default + // Should not be done in CSS for javascript disabled compatibility + if ( !$( '#config__NamespaceType_other' ).is( ':checked' ) ) { + $( '.enabledByOther' ).closest( '.config-block' ).hide(); + } + + // Enable/disable "other" textboxes + $( '.enableForOther' ).click( function () { + var $textbox = $( document.getElementById( $( this ).attr( 'rel' ) ) ); + // FIXME: Ugh, this is ugly + if ( $( this ).val() === 'other' ) { + $textbox.prop( 'readonly', false ).closest( '.config-block' ).slideDown( 'fast' ); + } else { + $textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' ); + } + } ); + + // Synchronize radio button label for sitename with textbox + $label = $( 'label[for="config__NamespaceType_site-name"]' ); + labelText = $label.text(); + $label.text( labelText.replace( '$1', '' ) ); + $( '#config_wgSitename' ).on( 'keyup change', syncText ).each( syncText ); + + // Show/Hide memcached servers when needed + $( 'input[name$="config__MainCacheType"]' ).change( function () { + var $memc = $( '#config-memcachewrapper' ); + if ( $( 'input[name$="config__MainCacheType"]:checked' ).val() === 'memcached' ) { + $memc.show( 'slow' ); + } else { + $memc.hide( 'slow' ); + } + } ); + + function areReqsSatisfied( name ) { + var i, ext, skin, node; + if ( !extDependencyMap[ name ] ) { + return true; + } + + if ( extDependencyMap[ name ].extensions ) { + for ( i in extDependencyMap[ name ].extensions ) { + ext = extDependencyMap[ name ].extensions[ i ]; + node = document.getElementById( 'config_ext-' + ext ); + if ( !node || !node.checked ) { + return false; + } + } + } + if ( extDependencyMap[ name ].skins ) { + for ( i in extDependencyMap[ name ].skins ) { + skin = extDependencyMap[ name ].skins[ i ]; + node = document.getElementById( 'config_skin-' + skin ); + if ( !node || !node.checked ) { + return false; + } + } + } + + return true; + } + + // Disable checkboxes if the extension has dependencies + $( '.mw-ext-with-dependencies input' ).prop( 'disabled', true ); + $( '.config-ext-input[data-name]' ).on( 'change', function () { + $( '.mw-ext-with-dependencies input' ).each( function () { + var name = this.getAttribute( 'data-name' ); + if ( areReqsSatisfied( name ) ) { + // Re-enable it! + this.disabled = false; + } else { + // Uncheck and disable the checkbox + this.checked = false; + this.disabled = true; + } + } ); + } ); + } ); +}( jQuery ) ); diff --git a/www/wiki/mw-config/images/ajax-loader.gif b/www/wiki/mw-config/images/ajax-loader.gif new file mode 100644 index 00000000..72203fdd Binary files /dev/null and b/www/wiki/mw-config/images/ajax-loader.gif differ diff --git a/www/wiki/mw-config/images/bullet.gif b/www/wiki/mw-config/images/bullet.gif new file mode 100644 index 00000000..b43de48a Binary files /dev/null and b/www/wiki/mw-config/images/bullet.gif differ diff --git a/www/wiki/mw-config/images/critical-32.png b/www/wiki/mw-config/images/critical-32.png new file mode 100644 index 00000000..9870bab9 Binary files /dev/null and b/www/wiki/mw-config/images/critical-32.png differ diff --git a/www/wiki/mw-config/images/download-32.png b/www/wiki/mw-config/images/download-32.png new file mode 100644 index 00000000..6a29cc0b Binary files /dev/null and b/www/wiki/mw-config/images/download-32.png differ diff --git a/www/wiki/mw-config/images/help-question-hover.gif b/www/wiki/mw-config/images/help-question-hover.gif new file mode 100644 index 00000000..515138db Binary files /dev/null and b/www/wiki/mw-config/images/help-question-hover.gif differ diff --git a/www/wiki/mw-config/images/help-question.gif b/www/wiki/mw-config/images/help-question.gif new file mode 100644 index 00000000..b4fc9c5b Binary files /dev/null and b/www/wiki/mw-config/images/help-question.gif differ diff --git a/www/wiki/mw-config/images/info-32.png b/www/wiki/mw-config/images/info-32.png new file mode 100644 index 00000000..2f6d505d Binary files /dev/null and b/www/wiki/mw-config/images/info-32.png differ diff --git a/www/wiki/mw-config/images/installer-logo.png b/www/wiki/mw-config/images/installer-logo.png new file mode 100644 index 00000000..43b0e8a8 Binary files /dev/null and b/www/wiki/mw-config/images/installer-logo.png differ diff --git a/www/wiki/mw-config/images/tick-32.png b/www/wiki/mw-config/images/tick-32.png new file mode 100644 index 00000000..72673445 Binary files /dev/null and b/www/wiki/mw-config/images/tick-32.png differ diff --git a/www/wiki/mw-config/images/warning-32.png b/www/wiki/mw-config/images/warning-32.png new file mode 100644 index 00000000..f2db86f2 Binary files /dev/null and b/www/wiki/mw-config/images/warning-32.png differ diff --git a/www/wiki/mw-config/index.php b/www/wiki/mw-config/index.php new file mode 100644 index 00000000..a47822bb --- /dev/null +++ b/www/wiki/mw-config/index.php @@ -0,0 +1,82 @@ +startSession() ) { + if ( $installer->request->getVal( "css" ) ) { + // Do not display errors on css pages + $installer->outputCss(); + exit; + } + + $errors = $installer->getPhpErrors(); + $installer->showError( 'config-session-error', $errors[0] ); + $installer->finish(); + exit; + } + + $fingerprint = $installer->getFingerprint(); + if ( isset( $_SESSION['installData'][$fingerprint] ) ) { + $session = $_SESSION['installData'][$fingerprint]; + } else { + $session = array(); + } + + if ( !is_null( $wgRequest->getVal( 'uselang' ) ) ) { + $langCode = $wgRequest->getVal( 'uselang' ); + } elseif ( isset( $session['settings']['_UserLang'] ) ) { + $langCode = $session['settings']['_UserLang']; + } else { + $langCode = 'en'; + } + $wgLang = Language::factory( $langCode ); + RequestContext::getMain()->setLanguage( $wgLang ); + + $installer->setParserLanguage( $wgLang ); + + $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT]; + + $session = $installer->execute( $session ); + + $_SESSION['installData'][$fingerprint] = $session; +} diff --git a/www/wiki/mw-config/overrides/README b/www/wiki/mw-config/overrides/README new file mode 100644 index 00000000..9a9d84db --- /dev/null +++ b/www/wiki/mw-config/overrides/README @@ -0,0 +1,22 @@ +Don't modify the installer if you want to alter its behavior, including +the contents of generated LocalSettings.php in your package. Instead, +you can override classes used by the installer. + +You can override 3 classes: +* LocalSettingsGenerator - generates LocalSettings.php +* WebInstaller - web installer UI +* CliInstaller - command-line installer + +Example override: + +$overrides['LocalSettingsGenerator'] = 'MyLocalSettingsGenerator'; + +class MyLocalSettingsGenerator extends LocalSettingsGenerator { + function getText() { + // Modify an existing setting + $this->values['wgDefaultSkin'] = 'vector'; + // add a new setting + $ls = parent::getText(); + return $ls . "\n\$wgMiserMode = true;\n"; + } +} -- cgit v1.2.1