Upgrade auf MediaWiki 1.46.2 (neuestes Release) & moderne Goju-Kai Dojo Vereinsanmeldeseite
Deploy Development / deploy (push) Successful in 1m12s
Deploy Development / deploy (push) Successful in 1m12s
This commit is contained in:
1 parent
994bfd9b5b
commit
48784a59af
6 files changed
+248
-15
No files matched your search
@@ -2,35 +2,90 @@
|
||||
|
||||
namespace MediaWiki\Extension\KarateMedia;
|
||||
|
||||
use Html;
|
||||
use MediaWiki\Html\Html;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use OutputPage;
|
||||
use Parser;
|
||||
use PPFrame;
|
||||
use Skin;
|
||||
use Title;
|
||||
use MediaWiki\Title\Title;
|
||||
|
||||
class KarateMediaHooks {
|
||||
|
||||
/**
|
||||
* Registriert das <html5media>-Tag fuer Abwaertskompatibilitaet mit bestehenden Wiki-Seiten.
|
||||
*/
|
||||
public static function onParserFirstCallInit( Parser $parser ): bool {
|
||||
public static function onParserFirstCallInit( $parser ): bool {
|
||||
$parser->setHook( 'html5media', [ self::class, 'renderHtml5MediaTag' ] );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt CSS und JS fuer die Video-Steuerung (z.B. Zeitlupe fuer Kata/Bunkai).
|
||||
* Laedt CSS und JS fuer die Video-Steuerung sowie die gestaltete Vereins-Anmeldeseite.
|
||||
*/
|
||||
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ): void {
|
||||
public static function onBeforePageDisplay( $out, $skin ): void {
|
||||
$out->addModules( [ 'ext.karateMedia' ] );
|
||||
|
||||
$title = $out->getTitle();
|
||||
if ( $title && $title->isSpecial( 'Userlogin' ) ) {
|
||||
global $wgLogo, $wgKarateLoginTitle, $wgKarateLoginSubtitle, $wgKarateLoginNotice, $wgEmergencyContact;
|
||||
|
||||
$loginTitle = $wgKarateLoginTitle ?? 'Goju-Kai Karate-Do';
|
||||
$loginSubtitle = $wgKarateLoginSubtitle ?? 'Internes Vereins-Wiki & Technik-Videothek';
|
||||
$loginNotice = $wgKarateLoginNotice ?? (
|
||||
'Willkommen im Trainings- und Nachschlagewerk unseres Karate-Vereins! ' .
|
||||
'Hier findest du alle Kata-, Bunkai- und Kihon-Lehrvideos, Prüfungsordnungen sowie unser Dojo-Wissen. ' .
|
||||
'Der Zugriff ist geschützt und ausschließlich für aktive Vereinsmitglieder freigeschaltet.'
|
||||
);
|
||||
$contactEmail = $wgEmergencyContact ?? 'Wiki@gojukai-dojo.de';
|
||||
$logoUrl = $wgLogo ?: '/resources/assets/logo_goju-kai_Bleistift.png';
|
||||
|
||||
$headerCard = Html::rawElement(
|
||||
'div',
|
||||
[ 'class' => 'karate-login-hero' ],
|
||||
Html::rawElement(
|
||||
'div',
|
||||
[ 'class' => 'karate-login-brand' ],
|
||||
Html::element( 'img', [
|
||||
'src' => $logoUrl,
|
||||
'alt' => $loginTitle,
|
||||
'class' => 'karate-login-logo',
|
||||
] ) .
|
||||
Html::rawElement(
|
||||
'div',
|
||||
[ 'class' => 'karate-login-headings' ],
|
||||
Html::element( 'h2', [ 'class' => 'karate-login-title' ], $loginTitle ) .
|
||||
Html::element( 'p', [ 'class' => 'karate-login-subtitle' ], $loginSubtitle )
|
||||
)
|
||||
) .
|
||||
Html::rawElement(
|
||||
'div',
|
||||
[ 'class' => 'karate-login-notice' ],
|
||||
Html::element( 'p', [], $loginNotice ) .
|
||||
Html::rawElement(
|
||||
'p',
|
||||
[ 'class' => 'karate-login-contact' ],
|
||||
'Noch kein Benutzerkonto oder Probleme beim Anmelden? Schreib kurz an ' .
|
||||
Html::element( 'a', [ 'href' => 'mailto:' . $contactEmail ], $contactEmail ) . '.'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$footerLinks = Html::rawElement(
|
||||
'div',
|
||||
[ 'class' => 'karate-login-footer-links' ],
|
||||
Html::element( 'a', [ 'href' => '/index.php?title=Karate:Impressum' ], 'Impressum' ) .
|
||||
Html::element( 'span', [ 'class' => 'karate-login-sep' ], '·' ) .
|
||||
Html::element( 'a', [ 'href' => '/index.php?title=Karate:Datenschutz' ], 'Datenschutz' ) .
|
||||
Html::element( 'span', [ 'class' => 'karate-login-sep' ], '·' ) .
|
||||
Html::element( 'a', [ 'href' => 'mailto:' . $contactEmail ], 'Kontakt & Zugang anfragen' )
|
||||
);
|
||||
|
||||
$out->prependHTML( $headerCard );
|
||||
$out->addHTML( $footerLinks );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendert <html5media height="200" width="300">File:Beispiel.mp4</html5media>
|
||||
*/
|
||||
public static function renderHtml5MediaTag( ?string $input, array $args, Parser $parser, PPFrame $frame ): string {
|
||||
public static function renderHtml5MediaTag( ?string $input, array $args, $parser, $frame ): string {
|
||||
if ( $input === null || trim( $input ) === '' ) {
|
||||
return Html::element( 'span', [ 'class' => 'error' ], 'KarateMedia: Keine Mediendatei angegeben.' );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user