r28814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28813‎ | r28814 | r28815 >
Date:01:08, 24 December 2007
Author:yaron
Status:old
Tags:
Comment:
Removed special initialization of special pages - no longer needed
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_AddData.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_AddPage.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateCategory.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateProperty.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_EditData.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_Forms.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_Templates.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php
@@ -11,29 +11,8 @@
1212 global $IP;
1313 require_once( "$IP/includes/SpecialPage.php" );
1414
15 -global $sfgSpecialPagesSpecialInit;
16 -if ($sfgSpecialPagesSpecialInit) {
17 - global $wgSpecialPages;
18 - $wgSpecialPages['CreateCategory'] = 'SFCreateCategory';
 15+SpecialPage::addPage( new SpecialPage('CreateCategory','',true,'doSpecialCreateCategory',false) );
1916
20 - class SFCreateCategory extends SpecialPage {
21 -
22 - /**
23 - * Constructor
24 - */
25 - public function __construct() {
26 - smwfInitUserMessages();
27 - parent::__construct('CreateCategory', '', true);
28 - }
29 -
30 - function execute() {
31 - doSpecialCreateCategory();
32 - }
33 - }
34 -} else {
35 - SpecialPage::addPage( new SpecialPage('CreateCategory','',true,'doSpecialCreateCategory',false) );
36 -}
37 -
3817 function createCategoryText($default_form, $category_name, $parent_category) {
3918 global $sfgContLang;
4019
Index: trunk/extensions/SemanticForms/specials/SF_AddData.php
@@ -12,29 +12,8 @@
1313 global $IP;
1414 require_once( "$IP/includes/SpecialPage.php" );
1515
16 -global $sfgSpecialPagesSpecialInit;
17 -if ($sfgSpecialPagesSpecialInit) {
18 - global $wgSpecialPages;
19 - $wgSpecialPages['AddData'] = 'SFAddData';
20 -
21 - class SFAddData extends SpecialPage {
 16+SpecialPage::addPage( new SpecialPage('AddData','',true,'doSpecialAddData',false) );
2217
23 - /**
24 - * Constructor
25 - */
26 - public function __construct() {
27 - smwfInitUserMessages();
28 - SpecialPage::SpecialPage('AddData','',true,'doSpecialAddData',false);
29 - }
30 -
31 - function execute($query='') {
32 - doSpecialAddData($query);
33 - }
34 - }
35 -} else {
36 - SpecialPage::addPage( new SpecialPage('AddData','',true,'doSpecialAddData',false) );
37 -}
38 -
3918 function doSpecialAddData($query = '') {
4019 global $wgRequest;
4120
Index: trunk/extensions/SemanticForms/specials/SF_AddPage.php
@@ -12,29 +12,8 @@
1313 global $IP;
1414 require_once( "$IP/includes/SpecialPage.php" );
1515
16 -global $sfgSpecialPagesSpecialInit;
17 -if ($sfgSpecialPagesSpecialInit) {
18 - global $wgSpecialPages;
19 - $wgSpecialPages['AddPage'] = 'SFAddPage';
20 -
21 - class SFAddPage extends SpecialPage {
 16+SpecialPage::addPage( new SpecialPage('AddPage','',true,'doSpecialAddPage',false) );
2217
23 - /**
24 - * Constructor
25 - */
26 - public function __construct() {
27 - smwfInitUserMessages();
28 - parent::__construct('AddPage', '', true);
29 - }
30 -
31 - function execute($query='') {
32 - doSpecialAddPage($query);
33 - }
34 - }
35 -} else {
36 - SpecialPage::addPage( new SpecialPage('AddPage','',true,'doSpecialAddPage',false) );
37 -}
38 -
3918 function doSpecialAddPage($query = '') {
4019 global $wgOut, $wgRequest, $sfgScriptPath;
4120
Index: trunk/extensions/SemanticForms/specials/SF_Forms.php
@@ -10,31 +10,8 @@
1111 global $IP;
1212 require_once( "$IP/includes/SpecialPage.php" );
1313
14 -global $sfgSpecialPagesSpecialInit;
15 -if ($sfgSpecialPagesSpecialInit) {
16 - global $wgSpecialPages;
17 - $wgSpecialPages['Forms'] = 'SFForms';
18 -
19 - class SFForms extends SpecialPage {
 14+SpecialPage::addPage( new SpecialPage('Forms','',true,'doSpecialForms',false) );
2015
21 - /**
22 - * Constructor
23 - */
24 - public function __construct() {
25 - smwfInitUserMessages();
26 - parent::__construct('Forms', '', true);
27 - }
28 -
29 - function execute() {
30 - list( $limit, $offset ) = wfCheckLimits();
31 - $rep = new FormsPage();
32 - return $rep->doQuery( $offset, $limit );
33 - }
34 - }
35 -} else {
36 - SpecialPage::addPage( new SpecialPage('Forms','',true,'doSpecialForms',false) );
37 -}
38 -
3916 class FormsPage extends QueryPage {
4017 function getName() {
4118 return "Forms";
Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -12,29 +12,8 @@
1313 require_once( "$IP/includes/SpecialPage.php" );
1414 require_once( "$sfgIP/includes/SF_FormClasses.inc" );
1515
16 -global $sfgSpecialPagesSpecialInit;
17 -if ($sfgSpecialPagesSpecialInit) {
18 - global $wgSpecialPages;
19 - $wgSpecialPages['CreateForm'] = 'SFCreateForm';
20 -
21 - class SFCreateForm extends SpecialPage {
 16+SpecialPage::addPage( new SpecialPage('CreateForm','',true,'doSpecialCreateForm',false) );
2217
23 - /**
24 - * Constructor
25 - */
26 - public function __construct() {
27 - smwfInitUserMessages();
28 - parent::__construct('CreateForm', '', true);
29 - }
30 -
31 - function execute() {
32 - doSpecialCreateForm();
33 - }
34 - }
35 -} else {
36 - SpecialPage::addPage( new SpecialPage('CreateForm','',true,'doSpecialCreateForm',false) );
37 -}
38 -
3918 function doSpecialCreateForm() {
4019 global $wgOut, $wgRequest, $wgUser, $sfgScriptPath, $wgContLang;
4120 $db = wfGetDB( DB_SLAVE );
Index: trunk/extensions/SemanticForms/specials/SF_CreateProperty.php
@@ -13,29 +13,8 @@
1414 global $IP;
1515 require_once( "$IP/includes/SpecialPage.php" );
1616
17 -global $sfgSpecialPagesSpecialInit;
18 -if ($sfgSpecialPagesSpecialInit) {
19 - global $wgSpecialPages;
20 - $wgSpecialPages['CreateProperty'] = 'SFCreateProperty';
 17+SpecialPage::addPage( new SpecialPage('CreateProperty','',true,'doSpecialCreateProperty',false) );
2118
22 - class SFCreateProperty extends SpecialPage {
23 -
24 - /**
25 - * Constructor
26 - */
27 - public function __construct() {
28 - smwfInitUserMessages();
29 - parent::__construct('CreateProperty', '', true);
30 - }
31 -
32 - function execute() {
33 - doSpecialCreateProperty();
34 - }
35 - }
36 -} else {
37 - SpecialPage::addPage( new SpecialPage('CreateProperty','',true,'doSpecialCreateProperty',false) );
38 -}
39 -
4019 function createPropertyText($property_type, $allowed_values_str) {
4120 global $smwgContLang;
4221
Index: trunk/extensions/SemanticForms/specials/SF_Templates.php
@@ -10,31 +10,8 @@
1111 global $IP;
1212 require_once( "$IP/includes/SpecialPage.php" );
1313
14 -global $sfgSpecialPagesSpecialInit;
15 -if ($sfgSpecialPagesSpecialInit) {
16 - global $wgSpecialPages;
17 - $wgSpecialPages['Templates'] = 'SFTemplates';
 14+SpecialPage::addPage( new SpecialPage('Templates','',true,'doSpecialTemplates',false) );
1815
19 - class SFTemplates extends SpecialPage {
20 -
21 - /**
22 - * Constructor
23 - */
24 - public function __construct() {
25 - smwfInitUserMessages();
26 - parent::__construct('Templates', '', true);
27 - }
28 -
29 - function execute() {
30 - list( $limit, $offset ) = wfCheckLimits();
31 - $rep = new TemplatesPage();
32 - return $rep->doQuery( $offset, $limit );
33 - }
34 - }
35 -} else {
36 - SpecialPage::addPage( new SpecialPage('Templates','',true,'doSpecialTemplates',false) );
37 -}
38 -
3916 class TemplatesPage extends QueryPage {
4017 function getName() {
4118 return "Templates";
Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php
@@ -13,29 +13,8 @@
1414 global $IP;
1515 require_once( "$IP/includes/SpecialPage.php" );
1616
17 -global $sfgSpecialPagesSpecialInit;
18 -if ($sfgSpecialPagesSpecialInit) {
19 - global $wgSpecialPages;
20 - $wgSpecialPages['CreateTemplate'] = 'SFCreateTemplate';
21 -
22 - class SFCreateTemplate extends SpecialPage {
 17+SpecialPage::addPage( new SpecialPage('CreateTemplate','',true,'doSpecialCreateTemplate',false) );
2318
24 - /**
25 - * Constructor
26 - */
27 - public function __construct() {
28 - smwfInitUserMessages();
29 - parent::__construct('CreateTemplate', '', true);
30 - }
31 -
32 - function execute() {
33 - doSpecialCreateTemplate();
34 - }
35 - }
36 -} else {
37 - SpecialPage::addPage( new SpecialPage('CreateTemplate','',true,'doSpecialCreateTemplate',false) );
38 -}
39 -
4019 // Custom sort function, used in both getSemanticProperties() functions
4120 function cmp($a, $b) {
4221 if ($a == $b) {
Index: trunk/extensions/SemanticForms/specials/SF_EditData.php
@@ -11,29 +11,8 @@
1212 global $IP;
1313 require_once( "$IP/includes/SpecialPage.php" );
1414
15 -global $sfgSpecialPagesSpecialInit;
16 -if ($sfgSpecialPagesSpecialInit) {
17 - global $wgSpecialPages;
18 - $wgSpecialPages['EditData'] = 'SFEditData';
19 -
20 - class SFEditData extends SpecialPage {
 15+SpecialPage::addPage( new SpecialPage('EditData','',true,'doSpecialEditData',false) );
2116
22 - /**
23 - * Constructor
24 - */
25 - public function __construct() {
26 - smwfInitUserMessages();
27 - parent::__construct('EditData', '', true);
28 - }
29 -
30 - function execute($query = '') {
31 - doSpecialEditData($query);
32 - }
33 - }
34 -} else {
35 - SpecialPage::addPage( new SpecialPage('EditData','',true,'doSpecialEditData',false) );
36 -}
37 -
3817 function doSpecialEditData($query = '') {
3918 global $wgRequest;
4019
@@ -89,20 +68,19 @@
9069 // get contents of target page
9170 $target_title = Title::newFromText($target_name);
9271
93 - $s = wfMsg('sf_editdata_title', $form_title->getText(), $target_title->getPrefixedText());
94 - $wgOut->setPageTitle($s);
95 -
9672 if (! $form_title || ! $form_title->exists() ) {
9773 if ($form_name == '')
98 - $text = '<p>' . wfMsg('sf_editdata_badurl') . "</p>\n";
 74+ $text = '<p class="error">' . wfMsg('sf_editdata_badurl') . "</p>\n";
9975 else
100 - $text = "<p>Error: No form page was found at " . sffLinkText(SF_NS_FORM, $form_name) . ".</p>\n";
 76+ $text = '<p class="error">Error: No form page was found at ' . sffLinkText(SF_NS_FORM, $form_name) . ".</p>\n";
10177 } elseif (! $target_title || ! $target_title->exists() ) {
10278 if ($target_name == '')
103 - $text = '<p>' . wfMsg('sf_editdata_badurl') . "</p>\n";
 79+ $text = '<p class="error">' . wfMsg('sf_editdata_badurl') . "</p>\n";
10480 else
105 - $text = "<p>Error: No page was found at " . sffLinkText(null, $target_name) . ".</p>\n";
 81+ $text = '<p class="error">Error: No page was found at ' . sffLinkText(null, $target_name) . ".</p>\n";
10682 } else {
 83+ $s = wfMsg('sf_editdata_title', $form_title->getText(), $target_title->getPrefixedText());
 84+ $wgOut->setPageTitle($s);
10785 $form_article = new Article($form_title);
10886 $form_definition = $form_article->getContent();
10987 $submit_url = $form_title->getLocalURL('action=submit');

Status & tagging log