r98101 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98100‎ | r98101 | r98102 >
Date:00:52, 26 September 2011
Author:yaron
Status:deferred
Tags:
Comment:
Title of 'edit schema' tab and page now shows up as "Create schema" if schema doesn't exist
Modified paths:
  • /trunk/extensions/PageSchemas/PS_Tabs.php (modified) (history)
  • /trunk/extensions/PageSchemas/specials/PS_EditSchema.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/PS_Tabs.php
@@ -16,17 +16,19 @@
1717 return true;
1818 }
1919
 20+ $category = $title->getText();
 21+ $pageSchemaObj = new PSSchema( $category );
 22+ $isPSDefined = $pageSchemaObj->isPSDefined();
 23+
2024 global $wgRequest;
2125
2226 $content_actions['editschema'] = array(
23 - 'text' => wfMsg( 'editschema' ),
 27+ 'text' => ( $isPSDefined ) ? wfMsg( 'editschema' ) : wfMsg( 'createschema' ),
2428 'class' => $wgRequest->getVal( 'action' ) == 'editschema' ? 'selected' : '',
2529 'href' => $title->getLocalURL( 'action=editschema' )
2630 );
2731
28 - $category = $title->getText();
29 - $pageSchemaObj = new PSSchema( $category );
30 - if ( $pageSchemaObj->isPSDefined() ) {
 32+ if ( $isPSDefined ) {
3133 $content_actions['generatepages'] = array(
3234 'text' => wfMsg( 'generatepages' ),
3335 'class' => $wgRequest->getVal( 'action' ) == 'generatepages' ? 'selected' : '',
Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
@@ -530,11 +530,13 @@
531531 $row = $dbr->fetchRow( $res );
532532 if ( $row == null && !$title->exists() ) {
533533 // Category doesn't exist.
 534+ $wgOut->setPageTitle( wfMsg( 'createschema' ) );
534535 $text = '<p>' . wfMsg( 'ps-page-desc-cat-not-exist' ) . '</p>';
535536 $text .= self::printForm();
536537 } elseif ( ( $row[1] != 'PageSchema' ) || ( $row[2] == null ) ) {
537538 // Category exists, but has no page schema.
538539 $text = '<p>' . wfMsg( 'ps-page-desc-ps-not-exist' ) . '</p>';
 540+ $wgOut->setPageTitle( wfMsg( 'createschema' ) );
539541 $text .= self::printForm();
540542 } else {
541543 // It's a category with an existing page schema -

Status & tagging log