Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show edit window and buttons below changes when using PageForms #406

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions resources/styles/_extensionfixes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@
.wikiEditor-ui * {
box-sizing: content-box;
}

/* Extension PageForm */
form#pfForm {
clear: both;
border-top: $hr-border-width solid $hr-border-color;
}
2 changes: 1 addition & 1 deletion src/ChameleonTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function execute() {
if ( !$bodyOnly ) {
$this->html( 'headelement' );
}
echo $this->getSkin()->getComponentFactory()->getRootComponent()->getHtml();
echo $this->getSkin()->getComponentFactory()->getRootComponent()->getHtml($this);
if ( !$bodyOnly ) {
$this->printTrail();
echo "</body>\n</html>";
Expand Down
6 changes: 5 additions & 1 deletion src/Components/CategoryLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ class CategoryLinks extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
return $this->indent() . '<!-- category links -->' .
$this->indent() . $this->getSkinTemplate()->get( 'catlinks' );
}
Expand Down
11 changes: 10 additions & 1 deletion src/Components/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ public function getSkinTemplate() {
return $this->mSkinTemplate;
}

/**
* @param ChameleonTemplate $tpl
* @return void
*/
public function setSkinTemplate( $tpl ) {
$this->mSkinTemplate = $tpl;
}

/**
* @since 1.1
* @return \Skins\Chameleon\Chameleon
Expand Down Expand Up @@ -173,9 +181,10 @@ public function getDomElement() {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
*/
abstract public function getHtml();
abstract public function getHtml( $tpl );

/**
* @return string[] the resource loader modules needed by this component
Expand Down
8 changes: 6 additions & 2 deletions src/Components/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ class Container extends Structure {
/**
* Builds the HTML code for the main container
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$attribs = [ 'class' => $this->getClassString() ];

$id = $this->getAttribute( 'id' );
Expand All @@ -60,7 +64,7 @@ public function getHtml() {
$ret = $this->indent() . \Html::openElement( 'div', $attribs );
$this->indent( 1 );

$ret .= parent::getHtml();
$ret .= parent::getHtml( $tpl );

$ret .= $this->indent( -1 ) . '</div>';

Expand Down
6 changes: 5 additions & 1 deletion src/Components/ContentBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ class ContentBody extends Component {

/**
* @inheritDoc
* @param ChameleonTemplate $tpl
* @throws \MWException
*/
public function getHtml(): string {
public function getHtml($tpl = null): string {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
return $this->buildContentBody();
}

Expand Down
6 changes: 5 additions & 1 deletion src/Components/ContentHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ class ContentHeader extends Component {

/**
* @inheritDoc
* @param ChameleonTemplate $tpl
* @throws \MWException
*/
public function getHtml(): string {
public function getHtml($tpl = null): string {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
return $this->buildContentHeader();
}

Expand Down
6 changes: 5 additions & 1 deletion src/Components/FooterIcons.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ class FooterIcons extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
return $this->indent() . '<!-- footer icons -->' .
IdRegistry::getRegistry()->element(
'div',
Expand Down
6 changes: 5 additions & 1 deletion src/Components/FooterInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ class FooterInfo extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
return $this->indent() . '<!-- footer links -->' .
IdRegistry::getRegistry()->element(
'div',
Expand Down
6 changes: 5 additions & 1 deletion src/Components/FooterPlaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ class FooterPlaces extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
return $this->indent() . '<!-- places -->' .
IdRegistry::getRegistry()->element(
'div',
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ class Html extends Component {
/**
* Builds the HTML code for the main container
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$ret = '';

if ( $this->getDomElement() !== null ) {
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Indicators.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ class Indicators extends Component {

/**
* @inheritDoc
* @param ChameleonTemplate $tpl
* @throws \MWException
*/
public function getHtml(): string {
public function getHtml($tpl = null): string {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$idRegistry = IdRegistry::getRegistry();

return $idRegistry->element( 'div', [ 'id' => 'mw-indicators',
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ class Logo extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$logo = $this->indent( 1 ) . $this->getLogo();

return $this->indent( -1 ) . '<!-- logo and main page link -->' .
Expand Down
6 changes: 5 additions & 1 deletion src/Components/MainContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ class MainContent extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$idRegistry = IdRegistry::getRegistry();

$topAnchor = $idRegistry->element( 'a', [ 'id' => 'top' ] );
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ class Menu extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
if ( $this->getDomElement() === null ) {
return '';
}
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ class Message extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$name = $this->getAttribute( 'name' );
if ( !empty( $name ) ) {
return $this->getSkinTemplate()->getMsg( $name )->parse();
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Modifications/Modification.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ public function getDomElement() {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$this->applyModification();
return $this->getComponent()->getHtml();
}
Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ class NavMenu extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return string the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$ret = '';

$sidebar = $this->getSkinTemplate()->getSidebar(
Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavbarHorizontal.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ class NavbarHorizontal extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
if ( $this->mHtml === null ) {
$this->buildHtml();
}
Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavbarHorizontal/LangLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ class LangLinks extends Component {
/**
* Builds the HTML code for this component
*
* @param ChameleonTemplate $tpl
* @return String the HTML code
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
if ( !$this->hasLangLinks() ) {
return '';
}
Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavbarHorizontal/Logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@
class Logo extends Component {

/**
* @param ChameleonTemplate $tpl
* @return String
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$logo = new GenLogo( $this->getSkinTemplate(), $this->getDomElement(), $this->getIndent() );
$logo->addClasses( 'navbar-brand' );

Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavbarHorizontal/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@
class Menu extends Component {

/**
* @param ChameleonTemplate $tpl
* @return String
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$menu = new GenMenu( $this->getSkinTemplate(), $this->getDomElement(), $this->getIndent() );
return $menu->getHtml();
}
Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavbarHorizontal/NavMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@
class NavMenu extends Component {

/**
* @param ChameleonTemplate $tpl
* @return String
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$navMenu = new GenNavMenu( $this->getSkinTemplate(), $this->getDomElement(),
$this->getIndent() + 1 );
return $navMenu->getHtml();
Expand Down
6 changes: 5 additions & 1 deletion src/Components/NavbarHorizontal/PageTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@
class PageTools extends Component {

/**
* @param ChameleonTemplate $tpl
* @return string
* @throws \ConfigException
* @throws \MWException
*/
public function getHtml() {
public function getHtml($tpl = null) {
if ( !is_null( $tpl ) ) {
$this->setSkinTemplate( $tpl );
}
$pageTools = $this->createGenericPageTools();

$this->indent( 1 );
Expand Down
Loading
Loading