mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-26 15:21:51 +00:00
4987c07793
* Move SpecialCollabPad.php to /. * Move screenshots for BetaFeatures to images/. * Move localisation messages to i18n/. Change-Id: I874ae135a3ac58118c3dea105136c8c8b6fb41bc
83 lines
2.1 KiB
PHP
83 lines
2.1 KiB
PHP
<?php
|
|
class SpecialCollabPad extends SpecialPage {
|
|
private $prefixes = [];
|
|
|
|
/**
|
|
* @var null|Title
|
|
*/
|
|
private $title = null;
|
|
|
|
/**
|
|
* @var null|ParserOutput
|
|
*/
|
|
private $output = null;
|
|
|
|
public function __construct() {
|
|
parent::__construct( 'CollabPad' );
|
|
}
|
|
|
|
protected function getGroupName() {
|
|
return 'wiki';
|
|
}
|
|
|
|
public function userCanExecute( User $user ) {
|
|
global $wgVisualEditorRebaserURL;
|
|
return !!$wgVisualEditorRebaserURL && parent::userCanExecute( $user );
|
|
}
|
|
|
|
public function isListed() {
|
|
global $wgVisualEditorRebaserURL;
|
|
return !!$wgVisualEditorRebaserURL;
|
|
}
|
|
|
|
public function execute( $par ) {
|
|
$this->setHeaders();
|
|
$this->checkPermissions();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$output = $this->getOutput();
|
|
|
|
$output->addJsConfigVars( 'collabPadPageName', $par );
|
|
$output->addModuleStyles( 'ext.visualEditor.collabTarget.init.styles' );
|
|
$output->addModules( 'ext.visualEditor.collabTarget.init' );
|
|
|
|
$output->enableOOUI();
|
|
|
|
$documentNameField = new OOUI\ActionFieldLayout(
|
|
new OOUI\TextInputWidget( [
|
|
'classes' => [ 've-init-mw-collabTarget-nameInput' ],
|
|
'placeholder' => $this->msg( 'visualeditor-rebase-client-document-name' )->text(),
|
|
'autofocus' => true,
|
|
'infusable' => true
|
|
] ),
|
|
new OOUI\ButtonWidget( [
|
|
'classes' => [ 've-init-mw-collabTarget-nameButton' ],
|
|
'label' => $this->msg( 'visualeditor-rebase-client-document-create-edit' )->text(),
|
|
// Only enable once JS has loaded
|
|
'disabled' => true,
|
|
'infusable' => true
|
|
] ),
|
|
[
|
|
'classes' => [ 've-init-mw-collabTarget-nameField' ],
|
|
'infusable' => true
|
|
]
|
|
);
|
|
$progressBar = new OOUI\ProgressBarWidget( [
|
|
'classes' => [ 've-init-mw-collabTarget-loading' ],
|
|
'infusable' => true
|
|
] );
|
|
|
|
if ( $par ) {
|
|
$title = Title::newFromText( $par );
|
|
$output->setPageTitle( 'CollabPad: ' . $title->getPrefixedText() );
|
|
$documentNameField->addClasses( [ 'oo-ui-element-hidden' ] );
|
|
} else {
|
|
// Scripts only, styles already added above
|
|
$output->addModules( 'ext.visualEditor.collabTarget' );
|
|
$progressBar->addClasses( [ 'oo-ui-element-hidden' ] );
|
|
}
|
|
$output->addHTML( $progressBar . $documentNameField );
|
|
}
|
|
}
|