Nasty has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/385330 )
Change subject: Initial commit. Added all files from BlueSpiceExtensions/Preferences ...................................................................... Initial commit. Added all files from BlueSpiceExtensions/Preferences Change-Id: Ica5322b4ffd2b0fcafe962a63ef5f9a47b77a474 --- A CODE_OF_CONDUCT.md A Preferences.class.php A composer.json A doc/Hooks.txt A extension.json A i18n/ast.json A i18n/atj.json A i18n/av.json A i18n/ba.json A i18n/be-tarask.json A i18n/bn.json A i18n/br.json A i18n/ca.json A i18n/cnh.json A i18n/de.json A i18n/diq.json A i18n/dty.json A i18n/el.json A i18n/en.json A i18n/es.json A i18n/eu.json A i18n/fa.json A i18n/fr.json A i18n/gl.json A i18n/he.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/ksh.json A i18n/ku-latn.json A i18n/lb.json A i18n/li.json A i18n/lij.json A i18n/lki.json A i18n/lt.json A i18n/mai.json A i18n/mk.json A i18n/mr.json A i18n/nb.json A i18n/ne.json A i18n/nl.json A i18n/pl.json A i18n/ps.json A i18n/pt-br.json A i18n/pt.json A i18n/qqq.json A i18n/roa-tara.json A i18n/ru.json A i18n/sl.json A i18n/sr-ec.json A i18n/sv.json A i18n/ta.json A i18n/tcy.json A i18n/uk.json A i18n/zh-hans.json A i18n/zh-hant.json A includes/specials/SpecialBlueSpicePreferences.alias.php A includes/specials/SpecialBlueSpicePreferences.php A resources/bluespice.preferences.js 59 files changed, 921 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceConfigManager refs/changes/30/385330/1 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..d8e5d08 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1 @@ +The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Code_of_Conduct). diff --git a/Preferences.class.php b/Preferences.class.php new file mode 100644 index 0000000..87bce6b --- /dev/null +++ b/Preferences.class.php @@ -0,0 +1,136 @@ +<?php +/** + * This is the Preferences class. + * + * The Preferences offers an easy way to manage the settings of BlueSpice. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This file is part of BlueSpice MediaWiki + * For further information visit http://www.bluespice.com + * + * @author Sebastian Ulbricht <[email protected]> + * @version 2.23.1 + * @package Bluespice_Extensions + * @subpackage Preferences + * @copyright Copyright (C) 2016 Hallo Welt! GmbH, All rights reserved. + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or later + * @filesource + */ + +// Last review MRG (01.07.11 13:56) + +/** + * the Preferences class + * @package BlueSpice_Extensions + * @subpackage Preferences + */ +class BsPreferences extends BsExtensionMW { + + public function __construct() { + wfProfileIn( 'BS::' . __METHOD__ ); + // Base settings + $this->mExtensionFile = __FILE__; + $this->mExtensionType = EXTTYPE::SPECIALPAGE; + + WikiAdmin::registerModule( 'BlueSpicePreferences', [ + 'image' => '/extensions/BlueSpiceExtensions/WikiAdmin/resources/images/bs-btn_einstellungen_v1.png', + 'level' => 'wikiadmin', + 'message' => 'bs-bluespicepreferences-label', + 'iconCls' => 'bs-icon-wrench', + 'permissions' => [ 'bluespicepreferences-viewspecialpage' ], + ]); + + wfProfileOut( 'BS::' . __METHOD__ ); + } + + protected function initExt() { + $this->mCore->registerPermission( 'bluespicepreferences-viewspecialpage', array( 'sysop' ), array( 'type' => 'global' ) ); + } + + /** + * saves the settings to the database + * @param array $aData an associative array of fieldnames and values + */ + public function savePreferences( $aData ) { + if ( wfReadOnly() ) { + $url = SpecialPage::getTitleFor( 'WikiAdmin' )->getFullURL( array( + 'mode' => 'Preferences', + 'success' => 0 + ) ); + $this->getOutput()->redirect( $url ); + + return false; + } + + $vars = BsConfig::getRegisteredVars(); + foreach ( $vars as $var ) { + $options = $var->getOptions(); + if ( !( $options & ( BsConfig::LEVEL_PUBLIC | BsConfig::LEVEL_USER ) ) ) { + continue; + } + if ( $options & BsConfig::NO_DEFAULT ) continue; + + $name = $this->generateFieldId( $var ); + $value = isset( $aData[$name] ) ? $aData[$name] : NULL; + if ( ( $var->getOptions() & BsConfig::TYPE_BOOL ) && $value == NULL ) { + BsConfig::set($var->getKey(), 0, true); + } + + $bReturn = true; + + Hooks::run( 'BSWikiAdminPreferencesBeforeSetVariable', array( $this, &$var, &$value, &$bReturn ) ); + + if ( $value !== null && $bReturn !== false ) { + BsConfig::set( $var->getKey(), $value, true ); + } + } + + BsConfig::saveSettings(); + + $url = SpecialPage::getTitleFor( 'WikiAdmin' )->getFullURL( array( + 'mode' => 'Preferences', + 'success' => 1 + ) ); + $this->getOutput()->redirect( $url ); + + return false; + } + + /** + * generates an id string for a BsCOnfig instance for usage in html code + * @param BsConfig $var + * @return string the field id + */ + protected function generateFieldId( $var ) { + return $var->getAdapter() . "_" . $var->getExtension() . "_" . $var->getName(); + } + + public static function onBeforePageDisplay( OutputPage &$out, &$skin ) { + if( !$out->getTitle()->isSpecial( 'WikiAdmin' ) ) { + return true; + } + if( strtolower( $out->getRequest()->getVal( 'mode' ) ) != 'preferences' ){ + return true; + } + + $out->addInlineStyle( + '.bs-prefs legend{cursor:pointer;}' + ); + + return true; + } + +} \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..94a7670 --- /dev/null +++ b/composer.json @@ -0,0 +1,9 @@ +{ + "name": "mediawiki/BlueSpiceConfigManager", + "type": "mediawiki-extension", + "description": "BlueSpiceConfigManager", + "license": "GPL-3.0", + "require": { + "composer/installers": "~1.0" + } +} \ No newline at end of file diff --git a/doc/Hooks.txt b/doc/Hooks.txt new file mode 100644 index 0000000..a1060da --- /dev/null +++ b/doc/Hooks.txt @@ -0,0 +1,7 @@ +==Prefernces.class.php== + +'BSWikiAdminPreferencesBeforeSetVariable': + $this: + &$var: + &$value: + &$bReturn: diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..9607ffa --- /dev/null +++ b/extension.json @@ -0,0 +1,50 @@ +{ + "name": "BlueSpiceConfigManager", + "version": "2.27.1-alpha", + "url": "https://help.bluespice.com/index.php/Preferences", + "author": [ + "Sebastian Ulbricht", + "Stephan Muggli" + ], + "descriptionmsg": "bs-preferences-desc", + "license-name": "GPL-2.0+", + "type": "bluespice", + "bsgExtensions": { + "Preferences": { + "className": "BsPreferences", + "extPath": "/BlueSpiceConfigManager" + } + }, + "MessagesDirs": { + "Preferences": [ + "i18n" + ] + }, + "AutoloadClasses": { + "BsPreferences": "Preferences.class.php", + "SpecialBlueSpicePreferences": "includes/specials/SpecialBlueSpicePreferences.php" + }, + "ExtensionMessagesFiles": { + "BlueSpicePreferencesAlias": "includes/specials/SpecialBlueSpicePreferences.alias.php" + }, + "SpecialPages": { + "BlueSpicePreferences": "SpecialBlueSpicePreferences" + }, + "ResourceModules": { + "ext.bluespice.preferences": { + "scripts": "bluespice.preferences.js", + "dependencies": [ + "jquery.cookie" + ] + } + }, + "ResourceFileModulePaths": { + "localBasePath": "resources", + "remoteExtPath": "BlueSpiceConfigManager/resources" + }, + "Hooks": { + "BeforePageDisplay": "BsPreferences::onBeforePageDisplay" + }, + "manifest_version": 1, + "load_composer_autoloader" : true +} diff --git a/i18n/ast.json b/i18n/ast.json new file mode 100644 index 0000000..a5ee49c --- /dev/null +++ b/i18n/ast.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Xuacu", + "Crucifunked" + ] + }, + "bs-preferences-desc": "Da a los alministradores la posibilidá de configurar tola wiki dende una sola páxina especial", + "bs-bluespicepreferences-label": "Preferencies", + "action-bluespicepreferences-viewspecialpage": "ver páxina especial \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferencies de Bluespice" +} diff --git a/i18n/atj.json b/i18n/atj.json new file mode 100644 index 0000000..a26655a --- /dev/null +++ b/i18n/atj.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Benoit Rochon" + ] + }, + "bs-bluespicepreferences-label": "Kirowe" +} diff --git a/i18n/av.json b/i18n/av.json new file mode 100644 index 0000000..b8ed62e --- /dev/null +++ b/i18n/av.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Gazimagomedov" + ] + }, + "bs-preferences-desc": "BlueSpice рекъезаби админитратированиялъе интерфейс", + "bs-preferences-label": "Рекъезаби" +} diff --git a/i18n/ba.json b/i18n/ba.json new file mode 100644 index 0000000..50cdcf6 --- /dev/null +++ b/i18n/ba.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Sagan" + ] + }, + "bs-preferences-desc": "Хакимдәргә бөтә викины бер махсус биттә көйләргә мөмкинлек бирә.", + "bs-preferences-label": "Көйләүҙәр" +} diff --git a/i18n/be-tarask.json b/i18n/be-tarask.json new file mode 100644 index 0000000..edad20b --- /dev/null +++ b/i18n/be-tarask.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Red Winged Duck" + ] + }, + "bs-preferences-desc": "Дае магчымасьць адміністратарам наладзіць усю вікі з адной спэцыяльнай старонкі", + "bs-bluespicepreferences-label": "Налады", + "action-bluespicepreferences-viewspecialpage": "прагляд спэцыяльнай старонкі «{{int:bluespicepreferences}}»", + "bluespicepreferences": "Налады Bluespice" +} diff --git a/i18n/bn.json b/i18n/bn.json new file mode 100644 index 0000000..5fb8648 --- /dev/null +++ b/i18n/bn.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Bodhisattwa" + ] + }, + "bs-preferences-label": "পছন্দসমূহ" +} diff --git a/i18n/br.json b/i18n/br.json new file mode 100644 index 0000000..92ef165 --- /dev/null +++ b/i18n/br.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Fohanno" + ] + }, + "bs-preferences-desc": "Etrefas merañ da gefluniañ BlueSpice", + "bs-preferences-label": "Penndibaboù" +} diff --git a/i18n/ca.json b/i18n/ca.json new file mode 100644 index 0000000..277f9ec --- /dev/null +++ b/i18n/ca.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Edustus" + ] + }, + "bs-preferences-label": "Preferències" +} diff --git a/i18n/cnh.json b/i18n/cnh.json new file mode 100644 index 0000000..41a11cd --- /dev/null +++ b/i18n/cnh.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Salai" + ] + }, + "bs-preferences-desc": "SpecialPage pakhat chung in wiki vialte remhnak ding caah admins pawl sikhawhnak lam chim hna", + "bs-preferences-label": "Duhning" +} diff --git a/i18n/de.json b/i18n/de.json new file mode 100644 index 0000000..0bbfbc3 --- /dev/null +++ b/i18n/de.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": [ + "Stephan Muggli <[email protected]>", + "Metalhead64" + ] + }, + "bs-preferences-desc": "Bietet die Möglichkeit für Administratoren, das ganze Wiki mit einer einzigen Spezialseite zu konfigurieren", + "prefs-bluespice": "BlueSpice", + "bs-bluespicepreferences-label": "Einstellungen", + "action-bluespicepreferences-viewspecialpage": "die Spezialseite „{{int:bluespicepreferences}}“ anzusehen", + "bluespicepreferences": "BlueSpice-Einstellungen" +} diff --git a/i18n/diq.json b/i18n/diq.json new file mode 100644 index 0000000..dc83b5b --- /dev/null +++ b/i18n/diq.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Kumkumuk" + ] + }, + "bs-bluespicepreferences-label": "Tercihi" +} diff --git a/i18n/dty.json b/i18n/dty.json new file mode 100644 index 0000000..a3d561f --- /dev/null +++ b/i18n/dty.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Nirajan pant" + ] + }, + "action-bluespicepreferences-viewspecialpage": "खास पान्नो \"{{int:bluespicepreferences}}\" हेर:" +} diff --git a/i18n/el.json b/i18n/el.json new file mode 100644 index 0000000..dd8b9c4 --- /dev/null +++ b/i18n/el.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Nikosgranturismogt" + ] + }, + "bs-preferences-desc": "Προσφέρει την δυνατότητα στους διαχειριστές, να διαμορφώσουν ολόκληρο το wiki από μια ειδική σελίδα", + "bs-bluespicepreferences-label": "Προτιμήσεις", + "action-bluespicepreferences-viewspecialpage": "δείτε την ειδική σελίδα \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Προτιμήσεις του Bluespice" +} diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..27f3863 --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": [ + "Stephan Muggli <[email protected]>", + "Leonid Verhovskij <[email protected]>" + ] + }, + "bs-preferences-desc": "Offers the possibility to admins, to configurate the whole wiki from a single SpecialPage", + "prefs-bluespice": "BlueSpice", + "bs-bluespicepreferences-label": "Preferences", + "action-bluespicepreferences-viewspecialpage": "view specialpage \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Bluespice preferences" +} diff --git a/i18n/es.json b/i18n/es.json new file mode 100644 index 0000000..ecf6535 --- /dev/null +++ b/i18n/es.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Fitoschido", + "Macofe" + ] + }, + "bs-preferences-desc": "Permite a los administradores configurar todo el wiki desde una única página especial", + "bs-bluespicepreferences-label": "Preferencias", + "action-bluespicepreferences-viewspecialpage": "ver la página especial \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferencias de Bluespice" +} diff --git a/i18n/eu.json b/i18n/eu.json new file mode 100644 index 0000000..77fe98e --- /dev/null +++ b/i18n/eu.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Subi" + ] + }, + "bs-preferences-label": "Hobespenak" +} diff --git a/i18n/fa.json b/i18n/fa.json new file mode 100644 index 0000000..2043bfa --- /dev/null +++ b/i18n/fa.json @@ -0,0 +1,10 @@ +{ + "@metadata": { + "authors": [ + "Alirezaaa", + "Huji" + ] + }, + "bs-preferences-desc": "به مدیران این امکان را میدهد که تمام ویکی را از طریق یک صفحهٔ ویژه پیکربندی کنند", + "bs-preferences-label": "ترجیحات" +} diff --git a/i18n/fr.json b/i18n/fr.json new file mode 100644 index 0000000..cce78d5 --- /dev/null +++ b/i18n/fr.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Gomoko", + "Wladek92" + ] + }, + "bs-preferences-desc": "Offre la possibilité aux administrateurs de configurer l’ensemble du wiki depuis une unique page spéciale", + "bs-bluespicepreferences-label": "Préférences", + "action-bluespicepreferences-viewspecialpage": "voir la page spéciale \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Préférences Bluespice" +} diff --git a/i18n/gl.json b/i18n/gl.json new file mode 100644 index 0000000..49f3bf2 --- /dev/null +++ b/i18n/gl.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Elisardojm" + ] + }, + "bs-preferences-desc": "Permite ós administradores configurar todo o wiki desde huna única páxina especial", + "bs-bluespicepreferences-label": "Preferencias", + "action-bluespicepreferences-viewspecialpage": "ver a página especial \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferencias de Bluespice" +} diff --git a/i18n/he.json b/i18n/he.json new file mode 100644 index 0000000..3433e22 --- /dev/null +++ b/i18n/he.json @@ -0,0 +1,10 @@ +{ + "@metadata": { + "authors": [ + "Guycn2" + ] + }, + "bs-preferences-desc": "הצעת האפשרות למנהלי המערכת, להגדיר את תצורתו של כל אתר הוויקי בדף מיוחד אחד", + "bs-bluespicepreferences-label": "העדפות", + "action-bluespicepreferences-viewspecialpage": "לצפות בדף המיוחד \"{{int:bluespicepreferences}}\"" +} diff --git a/i18n/it.json b/i18n/it.json new file mode 100644 index 0000000..6815b1b --- /dev/null +++ b/i18n/it.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Beta16", + "Selven" + ] + }, + "bs-preferences-desc": "Offre la possibilità agli amministratori, di configurare tutta la wiki da un'unica pagina speciale", + "bs-bluespicepreferences-label": "Preferenze", + "action-bluespicepreferences-viewspecialpage": "vedere la pagina speciale \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferenze Bluespice" +} diff --git a/i18n/ja.json b/i18n/ja.json new file mode 100644 index 0000000..d14c147 --- /dev/null +++ b/i18n/ja.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Shirayuki" + ] + }, + "prefs-bluespice": "BlueSpice", + "bs-preferences-label": "個人設定" +} diff --git a/i18n/ko.json b/i18n/ko.json new file mode 100644 index 0000000..6d55bfe --- /dev/null +++ b/i18n/ko.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Revi", + "Ykhwong" + ] + }, + "bs-preferences-desc": "관리자가 하나의 특수 문서에서 위키 전체의 환경 설정을 수정할 수 있게 합니다", + "bs-bluespicepreferences-label": "환경 설정", + "action-bluespicepreferences-viewspecialpage": "특수문서 \"{{int:bluespicepreferences}}\" 보기", + "bluespicepreferences": "BlueSpice 설정" +} diff --git a/i18n/ksh.json b/i18n/ksh.json new file mode 100644 index 0000000..3b21161 --- /dev/null +++ b/i18n/ksh.json @@ -0,0 +1,10 @@ +{ + "@metadata": { + "authors": [ + "Purodha" + ] + }, + "bs-preferences-desc": "Deiht alle Enschtällonge för de Wikki-Köhbeße för et janze Wikki zosamme ob en eijnzel {{int:specialpage}}.", + "prefs-bluespice": "<i lang=\"en\" xml:lang=\"en\" dir=\"ltr\" title=\"„Blou Jewöhz“\">Blue-Spice</i>", + "bs-preferences-label": "Enschtällonge" +} diff --git a/i18n/ku-latn.json b/i18n/ku-latn.json new file mode 100644 index 0000000..cbf5e58 --- /dev/null +++ b/i18n/ku-latn.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Bikarhêner" + ] + }, + "bs-preferences-label": "Hevyazên min" +} diff --git a/i18n/lb.json b/i18n/lb.json new file mode 100644 index 0000000..9ba7754 --- /dev/null +++ b/i18n/lb.json @@ -0,0 +1,10 @@ +{ + "@metadata": { + "authors": [ + "Robby" + ] + }, + "bs-bluespicepreferences-label": "Astellungen", + "action-bluespicepreferences-viewspecialpage": "d'Spezialsäit \"{{int:bluespicepreferences}}\" weisen", + "bluespicepreferences": "BlueSpice-Astellungen" +} diff --git a/i18n/li.json b/i18n/li.json new file mode 100644 index 0000000..3540f71 --- /dev/null +++ b/i18n/li.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Pahles" + ] + }, + "bs-bluespicepreferences-label": "Veurkäöre" +} diff --git a/i18n/lij.json b/i18n/lij.json new file mode 100644 index 0000000..914214d --- /dev/null +++ b/i18n/lij.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Giromin Cangiaxo" + ] + }, + "bs-preferences-desc": "O l'ofre a poscibilitæ a-i aministratoî, de configuâ tutta a wiki da 'n'unnica paggina speciale", + "bs-bluespicepreferences-label": "Preferençe", + "action-bluespicepreferences-viewspecialpage": "amia a paggina speciale \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferençe Bluespice" +} diff --git a/i18n/lki.json b/i18n/lki.json new file mode 100644 index 0000000..c135b7a --- /dev/null +++ b/i18n/lki.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Hosseinblue", + "Lakzon" + ] + }, + "bs-preferences-label": "تمارزووەل(ترجیحات)" +} diff --git a/i18n/lt.json b/i18n/lt.json new file mode 100644 index 0000000..dd5f8ca --- /dev/null +++ b/i18n/lt.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Eitvys200" + ] + }, + "bs-preferences-desc": "Siūlo galimybę administratoriams konfigūruoti visą viki iš vieno SpecialausPuslapio", + "bs-bluespicepreferences-label": "Nustatymai", + "action-bluespicepreferences-viewspecialpage": "žiūrėti specialųpuslapį „{{int:bluespicepreferences}}“", + "bluespicepreferences": "BlueSpice parametrai" +} diff --git a/i18n/mai.json b/i18n/mai.json new file mode 100644 index 0000000..1a8d2ab --- /dev/null +++ b/i18n/mai.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "बिप्लब आनन्द" + ] + }, + "bs-preferences-desc": "एगो विशेष पन्ना सँ पूरा विकि विन्यास के लेल,माइनजनके सम्भावना प्रदान करएत अछि", + "bs-preferences-label": "विकल्प" +} diff --git a/i18n/mk.json b/i18n/mk.json new file mode 100644 index 0000000..fb04e95 --- /dev/null +++ b/i18n/mk.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Bjankuloski06" + ] + }, + "bs-preferences-desc": "Администраторска можност за нагодување на цело вики од една службена страница", + "bs-bluespicepreferences-label": "Нагодувања", + "action-bluespicepreferences-viewspecialpage": "погл. службената страница „{{int:bluespicepreferences}}“", + "bluespicepreferences": "Нагодувања на Bluespice" +} diff --git a/i18n/mr.json b/i18n/mr.json new file mode 100644 index 0000000..d73f457 --- /dev/null +++ b/i18n/mr.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "V.narsikar" + ] + }, + "bs-bluespicepreferences-label": "पसंतीक्रम" +} diff --git a/i18n/nb.json b/i18n/nb.json new file mode 100644 index 0000000..efcfca1 --- /dev/null +++ b/i18n/nb.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Jon Harald Søby" + ] + }, + "bs-preferences-desc": "Gir administratorer muligheten til å konfigurere hele wikien fra én enkel spesialside", + "bs-bluespicepreferences-label": "Innstillinger", + "action-bluespicepreferences-viewspecialpage": "vis spesialsiden «{{int:bluespicepreferences}}»", + "bluespicepreferences": "Bluespice-innstillinger" +} diff --git a/i18n/ne.json b/i18n/ne.json new file mode 100644 index 0000000..5aa0b07 --- /dev/null +++ b/i18n/ne.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "बिप्लब आनन्द" + ] + }, + "bs-preferences-label": "अभिरुचीहरु" +} diff --git a/i18n/nl.json b/i18n/nl.json new file mode 100644 index 0000000..8eea419 --- /dev/null +++ b/i18n/nl.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Esketti" + ] + }, + "bs-preferences-desc": "Biedt de mogelijkheid om beheerders te configureren de hele wiki van een enkele SpecialPage", + "bs-bluespicepreferences-label": "Voorkeuren" +} diff --git a/i18n/pl.json b/i18n/pl.json new file mode 100644 index 0000000..f13fcb2 --- /dev/null +++ b/i18n/pl.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Chrumps" + ] + }, + "bs-bluespicepreferences-label": "Preferencje", + "bluespicepreferences": "Ustawienia BlueSpice" +} diff --git a/i18n/ps.json b/i18n/ps.json new file mode 100644 index 0000000..0ae7e32 --- /dev/null +++ b/i18n/ps.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Ahmed-Najib-Biabani-Ibrahimkhel" + ] + }, + "bs-bluespicepreferences-label": "غوره توبونه" +} diff --git a/i18n/pt-br.json b/i18n/pt-br.json new file mode 100644 index 0000000..09c8148 --- /dev/null +++ b/i18n/pt-br.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": [ + "Felipe L. Ewald", + "Eduardo Addad de Oliveira" + ] + }, + "bs-preferences-desc": "Oferece a possibilidade aos administradores de configurar uma wiki por completo numa única página especial", + "prefs-bluespice": "BlueSpice", + "bs-bluespicepreferences-label": "Preferências", + "action-bluespicepreferences-viewspecialpage": "ver página especial \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferências do BlueSpice" +} diff --git a/i18n/pt.json b/i18n/pt.json new file mode 100644 index 0000000..a095873 --- /dev/null +++ b/i18n/pt.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Vitorvicentevalente" + ] + }, + "bs-preferences-desc": "Oferece a possibilidade aos administradores de configurar uma wiki por completo numa única página especial", + "bs-bluespicepreferences-label": "Preferências", + "action-bluespicepreferences-viewspecialpage": "ver página especial \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferências Bluespice" +} diff --git a/i18n/qqq.json b/i18n/qqq.json new file mode 100644 index 0000000..ce062cd --- /dev/null +++ b/i18n/qqq.json @@ -0,0 +1,15 @@ +{ + "@metadata": { + "authors": [ + "Stephan Muggli <[email protected]>", + "Shirayuki", + "Raymond", + "Umherirrender" + ] + }, + "bs-preferences-desc": "Used in [{{canonicalurl:Special:WikiAdmin|mode=ExtensionInfo}} Special:WikiAdmin?mode=ExtensionInfo], description of preferences extension", + "prefs-bluespice": "{{optional}}\nUsed in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], headline for bluespice section in preferences.\n{{Identical|BlueSpice}}", + "bs-bluespicepreferences-label": "Anchor text for preferences\n{{Identical|Preferences}}", + "action-bluespicepreferences-viewspecialpage": "label for denied special page\n{{doc-action|bluespicepreferences-viewspecialpage}}", + "bluespicepreferences": "title label for special page" +} diff --git a/i18n/roa-tara.json b/i18n/roa-tara.json new file mode 100644 index 0000000..e8636a6 --- /dev/null +++ b/i18n/roa-tara.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Joetaras" + ] + }, + "bs-preferences-desc": "Dèje 'a possibbilità a le amministrature, de configurà 'a uicchi da 'na pàgena singole SpecialPage", + "bs-bluespicepreferences-label": "Me piace accussì", + "action-bluespicepreferences-viewspecialpage": "'ndrucà 'a pagena speciale \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Preferenze de Bluespice" +} diff --git a/i18n/ru.json b/i18n/ru.json new file mode 100644 index 0000000..7f6cdc0 --- /dev/null +++ b/i18n/ru.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": [ + "Okras", + "Gazimagomedov", + "Facenapalm" + ] + }, + "bs-preferences-desc": "Дает возможность администраторам настроить всю вики на одной спецстранице", + "bs-bluespicepreferences-label": "Настройки", + "action-bluespicepreferences-viewspecialpage": "просмотр специальной страницы «{{int:bluespicepreferences}}»", + "bluespicepreferences": "Настройки BlueSpice" +} diff --git a/i18n/sl.json b/i18n/sl.json new file mode 100644 index 0000000..39d600b --- /dev/null +++ b/i18n/sl.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Skalcaa", + "Dbc334" + ] + }, + "bs-preferences-desc": "Skrbnikom ponuja možnost konfiguracije celotnega wiki-ja iz ene PosebneStrani", + "bs-bluespicepreferences-label": "Nastavitve", + "action-bluespicepreferences-viewspecialpage": "ogled posebne strani »{{int:bluespicepreferences}}«", + "bluespicepreferences": "Nastavitve Bluespice" +} diff --git a/i18n/sr-ec.json b/i18n/sr-ec.json new file mode 100644 index 0000000..1d7d918 --- /dev/null +++ b/i18n/sr-ec.json @@ -0,0 +1,9 @@ +{ + "@metadata": { + "authors": [ + "Milicevic01" + ] + }, + "bs-bluespicepreferences-label": "Подешавања", + "action-bluespicepreferences-viewspecialpage": "преглед посебне странице „{{int:bluespicepreferences}}“" +} diff --git a/i18n/sv.json b/i18n/sv.json new file mode 100644 index 0000000..af91f86 --- /dev/null +++ b/i18n/sv.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": [ + "Jopparn", + "Lokal Profil", + "WikiPhoenix" + ] + }, + "bs-preferences-desc": "Erbjuder möjligheten för administratörer att konfigurera hela wikin från en enda specialsida", + "bs-bluespicepreferences-label": "Inställningar", + "action-bluespicepreferences-viewspecialpage": "visa specialsidan \"{{int:bluespicepreferences}}\"", + "bluespicepreferences": "Bluespice-inställningar" +} diff --git a/i18n/ta.json b/i18n/ta.json new file mode 100644 index 0000000..523fef0 --- /dev/null +++ b/i18n/ta.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Rakeshonwiki" + ] + }, + "bs-bluespicepreferences-label": "விருப்பத்தேர்வுகள்" +} diff --git a/i18n/tcy.json b/i18n/tcy.json new file mode 100644 index 0000000..42f4e12 --- /dev/null +++ b/i18n/tcy.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "VASANTH S.N." + ] + }, + "bs-preferences-label": "ಪ್ರಾಶಸ್ತ್ಯೊಲು" +} diff --git a/i18n/uk.json b/i18n/uk.json new file mode 100644 index 0000000..1f4a310 --- /dev/null +++ b/i18n/uk.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": [ + "Ата", + "Andriykopanytsia", + "Piramidion" + ] + }, + "bs-preferences-desc": "Пропонує можливість адміністраторам для налаштування усього вікі з єдиної спеціальної сторінки", + "bs-bluespicepreferences-label": "Налаштування", + "action-bluespicepreferences-viewspecialpage": "перегляд спеціальної сторінки «{{int:bluespicepreferences}}»", + "bluespicepreferences": "Налаштування Bluespice" +} diff --git a/i18n/zh-hans.json b/i18n/zh-hans.json new file mode 100644 index 0000000..f63dba2 --- /dev/null +++ b/i18n/zh-hans.json @@ -0,0 +1,11 @@ +{ + "@metadata": { + "authors": [ + "Liuxinyu970226" + ] + }, + "bs-preferences-desc": "为管理员通过单一特殊页面配置整个wiki提供可能", + "bs-bluespicepreferences-label": "参数设置", + "action-bluespicepreferences-viewspecialpage": "查看特殊页面“{{int:bluespicepreferences}}”", + "bluespicepreferences": "Bluespice参数设置" +} diff --git a/i18n/zh-hant.json b/i18n/zh-hant.json new file mode 100644 index 0000000..a8cf5b5 --- /dev/null +++ b/i18n/zh-hant.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Cwlin0416" + ] + }, + "bs-preferences-label": "偏好設定" +} diff --git a/includes/specials/SpecialBlueSpicePreferences.alias.php b/includes/specials/SpecialBlueSpicePreferences.alias.php new file mode 100644 index 0000000..76df816 --- /dev/null +++ b/includes/specials/SpecialBlueSpicePreferences.alias.php @@ -0,0 +1,12 @@ +<?php +$specialPageAliases = array(); + +/** English */ +$specialPageAliases['en'] = array( + 'BlueSpicePreferences' => array( 'BlueSpicePreferences', 'BlueSpice preferences' ), +); + +/** German (Deutsch) */ +$specialPageAliases['de'] = array( + 'BlueSpicePreferences' => array( 'BlueSpice Einstellungen' ), +); diff --git a/includes/specials/SpecialBlueSpicePreferences.php b/includes/specials/SpecialBlueSpicePreferences.php new file mode 100644 index 0000000..ac08a45 --- /dev/null +++ b/includes/specials/SpecialBlueSpicePreferences.php @@ -0,0 +1,160 @@ +<?php + +class SpecialBlueSpicePreferences extends BsSpecialPage { + + public function __construct() { + parent::__construct( 'BlueSpicePreferences', 'bluespicepreferences-viewspecialpage' ); + + } + + /** + * + * @global OutputPage $this->getOutput() + * @param type $sParameter + * @return type + */ + public function execute( $sParameter ) { + parent::execute( $sParameter ); + + if ( wfReadOnly() ) { + throw new ReadOnlyError; + } + + $this->getOutput()->addModules( 'ext.bluespice.preferences' ); + $this->getOutput()->addHTML( '<br />' ); + + $oRequest = $this->getRequest(); + if ( $this->getRequest()->getVal( 'success' ) == true ) { + $this->getOutput()->wrapWikiMsg( + '<div class="successbox"><strong>$1</strong></div><div id="mw-pref-clear"></div>'."\n", + 'savedprefs' + ); + } + + $orig_deliver = BsConfig::deliverUsersSettings( false ); + + BsConfig::loadSettings(); + BsExtensionManager::getExtensionInformation(); + + $vars = BsConfig::getRegisteredVars(); + + $bShowall = $oRequest->getFuzzyBool( 'showall' ); + if ( $bShowall ) { + $out = ''; + foreach ( $vars as $var ) { + $out .= $var->getAdapter() . "::"; + if ( $var->getExtension() !== null ) { + $out .= $var->getExtension() . "::"; + } + $out .= $var->getName() . "<br>"; + } + + $this->getOutput()->addHTML( $out ); + } + + $preferences = array(); + $aSortedVariables = array(); + + foreach ( $vars as $var ) { + $options = $var->getOptions(); + if ( !( $options & ( BsConfig::LEVEL_PUBLIC | BsConfig::LEVEL_USER ) ) ) { + continue; + } + if ( $options & BsConfig::NO_DEFAULT ) continue; + $extension = $var->getI18nExtension() ? $var->getI18nExtension() : 'BASE'; + $aSortedVariables[$extension][] = $var; + } + + foreach ( $aSortedVariables as $sExtensionName => $aExtensions ) { + if ( !count( $aExtensions ) ) continue; + + foreach ( $aExtensions as $oVariable ) { + // if continue, then $oAdapterSetView is not added to output + if ( !count( $oVariable ) ) continue; + $sSection = $sExtensionName; + $oExtension = BsExtensionManager::getExtension( $sExtensionName ); + $field = $oVariable->getFieldDefinition( $sSection ); + + if ( $oVariable->getOptions() & BsConfig::USE_PLUGIN_FOR_PREFS ) { + + $oExtension = BsExtensionManager::getExtension( $sExtensionName ); + $tmp = $oExtension->runPreferencePlugin( 'MW', $oVariable ); + + $field = array_merge( $field, $tmp ); + } + $preferences[$oVariable->generateFieldId()] = $field; + + } + } + BsConfig::deliverUsersSettings( $orig_deliver ); + + $oForm = new HTMLFormEx( $preferences, 'prefs' ); + $oForm->setTitle( $this->getTitle() ); + $oForm->addHiddenField( 'mode', 'Preferences' ); + $oForm->setSubmitText( wfMessage( 'bs-extjs-save' )->plain() ); + $oForm->setSubmitName( 'WikiAdminPreferencesSubmit' ); + $oForm->setSubmitCallback( array( $this, 'savePreferences' ) ); + + $oForm->show(); + + $this->getOutput()->addHTML( '<br />' ); + } + + /** + * saves the settings to the database + * @param array $aData an associative array of fieldnames and values + */ + public function savePreferences( $aData ) { + if ( wfReadOnly() ) { + $url = SpecialPage::getTitleFor( 'WikiAdmin' )->getFullURL( array( + 'mode' => 'Preferences', + 'success' => 0 + ) ); + $this->getOutput()->redirect( $url ); + + return false; + } + + $vars = BsConfig::getRegisteredVars(); + foreach ( $vars as $var ) { + $options = $var->getOptions(); + if ( !( $options & ( BsConfig::LEVEL_PUBLIC | BsConfig::LEVEL_USER ) ) ) { + continue; + } + if ( $options & BsConfig::NO_DEFAULT ) continue; + + $name = $this->generateFieldId( $var ); + $value = isset( $aData[$name] ) ? $aData[$name] : NULL; + if ( ( $var->getOptions() & BsConfig::TYPE_BOOL ) && $value == NULL ) { + BsConfig::set($var->getKey(), 0, true); + } + + $bReturn = true; + + Hooks::run( 'BSWikiAdminPreferencesBeforeSetVariable', array( $this, &$var, &$value, &$bReturn ) ); + + if ( $value !== null && $bReturn !== false ) { + BsConfig::set( $var->getKey(), $value, true ); + } + } + + BsConfig::saveSettings(); + + $url = SpecialPage::getTitleFor( 'BlueSpicePreferences' )->getFullURL( array( + 'success' => 1 + ) ); + $this->getOutput()->redirect( $url ); + + return false; + } + + /** + * generates an id string for a BsCOnfig instance for usage in html code + * @param BsConfig $var + * @return string the field id + */ + protected function generateFieldId( $var ) { + return $var->getAdapter() . "_" . $var->getExtension() . "_" . $var->getName(); + } + +} diff --git a/resources/bluespice.preferences.js b/resources/bluespice.preferences.js new file mode 100644 index 0000000..96530ee --- /dev/null +++ b/resources/bluespice.preferences.js @@ -0,0 +1,29 @@ +( function ( mw, bs, $, undefined ) { + $(function(){ + $('.bs-prefs .bs-prefs-head').click( function() { + var oPrefsBody = $( this ).parent().find( '.bs-prefs-body' ), + sCookieKey = $( this ).parent().attr( 'id' )+'-viewstate'; + if ( oPrefsBody.is( ":visible" ) == true ) { + $(oPrefsBody[0]).slideUp(500); + $(oPrefsBody[0]).parent().addClass('bs-prefs-viewstate-collapsed'); + $.cookie(sCookieKey, null, { + path: '/' + }); + } else { + $(oPrefsBody[0]).slideDown(500); + $(oPrefsBody[0]).parent().removeClass('bs-prefs-viewstate-collapsed'); + $.cookie(sCookieKey, 'opened', { + path: '/', + expires: 10 + }); + } + }).each( function() { + var oPrefsBody = $(this).parent().find('.bs-prefs-body'), + sCookieKey = $(this).parent().attr('id')+'-viewstate'; + if ( sCookieKey != 'bluespice-viewstate' && ($.cookie( sCookieKey ) == null || $.cookie( sCookieKey ) != 'opened')) { + oPrefsBody.hide(); + $(oPrefsBody[0]).parent().addClass('bs-prefs-viewstate-collapsed'); + } + }); + }); +}( mediaWiki, blueSpice, jQuery ) ); \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/385330 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica5322b4ffd2b0fcafe962a63ef5f9a47b77a474 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceConfigManager Gerrit-Branch: master Gerrit-Owner: Nasty <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
