Yaron Koren has uploaded a new change for review.
https://gerrit.wikimedia.org/r/174048
Change subject: Added SMW-independence for helper special pages
......................................................................
Added SMW-independence for helper special pages
Special:CreateProperty and CreateCategory no longer load when SMW is not
installed, and Special:CreateTemplate operates with limited functionality.
Change-Id: I24870f3bf40ddd8bca550070fc9c516f1be40fab
---
M SemanticForms.php
M specials/SF_CreateTemplate.php
2 files changed, 32 insertions(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms
refs/changes/48/174048/1
diff --git a/SemanticForms.php b/SemanticForms.php
index 499969d..6d9727d 100644
--- a/SemanticForms.php
+++ b/SemanticForms.php
@@ -140,15 +140,17 @@
$GLOBALS['wgSpecialPages']['CreateTemplate'] = 'SFCreateTemplate';
$GLOBALS['wgAutoloadClasses']['SFCreateTemplate'] = __DIR__ .
'/specials/SF_CreateTemplate.php';
$GLOBALS['wgSpecialPageGroups']['CreateTemplate'] = 'sf_group';
-$GLOBALS['wgSpecialPages']['CreateProperty'] = 'SFCreateProperty';
-$GLOBALS['wgAutoloadClasses']['SFCreateProperty'] = __DIR__ .
'/specials/SF_CreateProperty.php';
-$GLOBALS['wgSpecialPageGroups']['CreateProperty'] = 'sf_group';
+if ( defined( 'SMW_VERSION' ) ) {
+ $GLOBALS['wgSpecialPages']['CreateProperty'] = 'SFCreateProperty';
+ $GLOBALS['wgAutoloadClasses']['SFCreateProperty'] = __DIR__ .
'/specials/SF_CreateProperty.php';
+ $GLOBALS['wgSpecialPageGroups']['CreateProperty'] = 'sf_group';
+ $GLOBALS['wgSpecialPages']['CreateClass'] = 'SFCreateClass';
+ $GLOBALS['wgAutoloadClasses']['SFCreateClass'] = __DIR__ .
'/specials/SF_CreateClass.php';
+ $GLOBALS['wgSpecialPageGroups']['CreateClass'] = 'sf_group';
+}
$GLOBALS['wgSpecialPages']['CreateCategory'] = 'SFCreateCategory';
$GLOBALS['wgAutoloadClasses']['SFCreateCategory'] = __DIR__ .
'/specials/SF_CreateCategory.php';
$GLOBALS['wgSpecialPageGroups']['CreateCategory'] = 'sf_group';
-$GLOBALS['wgSpecialPages']['CreateClass'] = 'SFCreateClass';
-$GLOBALS['wgAutoloadClasses']['SFCreateClass'] = __DIR__ .
'/specials/SF_CreateClass.php';
-$GLOBALS['wgSpecialPageGroups']['CreateClass'] = 'sf_group';
$GLOBALS['wgSpecialPages']['FormStart'] = 'SFFormStart';
$GLOBALS['wgAutoloadClasses']['SFFormStart'] = __DIR__ .
'/specials/SF_FormStart.php';
$GLOBALS['wgSpecialPageGroups']['FormStart'] = 'sf_group';
diff --git a/specials/SF_CreateTemplate.php b/specials/SF_CreateTemplate.php
index 9f36078..cfae77d 100644
--- a/specials/SF_CreateTemplate.php
+++ b/specials/SF_CreateTemplate.php
@@ -93,8 +93,11 @@
array( 'size' => '15' )
) . "\n";
- $dropdown_html = self::printPropertiesComboBox(
$all_properties, $id );
- $text .= "\t" . wfMessage( 'sf_createtemplate_semanticproperty'
)->text() . ' ' . $dropdown_html . "</p>\n";
+ if ( defined( 'SMW_VERSION' ) ) {
+ $dropdown_html = self::printPropertiesComboBox(
$all_properties, $id );
+ $text .= "\t" . wfMessage(
'sf_createtemplate_semanticproperty' )->text() . ' ' . $dropdown_html .
"</p>\n";
+ }
+
$text .= "\t<p>" . '<input type="checkbox" name="is_list_' .
$id . '" /> ' . wfMessage( 'sf_createtemplate_fieldislist' )->text() . "\n";
$text .= '   <input type="button" value="' .
wfMessage( 'sf_createtemplate_deletefield' )->text() . '" class="deleteField"
/>' . "\n";
@@ -246,7 +249,11 @@
$text .= "\t" . Html::element( 'legend', null, wfMessage(
'sf_createtemplate_templatefields' )->text() ) . "\n";
$text .= "\t" . Html::element( 'p', null, wfMessage(
'sf_createtemplate_fieldsdesc' )->text() ) . "\n";
- $all_properties = self::getAllPropertyNames();
+ if ( defined( 'SMW_VERSION' ) ) {
+ $all_properties = self::getAllPropertyNames();
+ } else {
+ $all_properties = array();
+ }
$text .= '<div id="fieldsList">' . "\n";
$text .= self::printFieldEntryBox( "1", $all_properties );
$text .= self::printFieldEntryBox( "starter", $all_properties,
false );
@@ -260,16 +267,20 @@
);
$text .= Html::rawElement( 'p', null, $add_field_button ) .
"\n";
$text .= "\t</fieldset>\n";
- $text .= "\t<fieldset>\n";
- $text .= "\t" . Html::element( 'legend', null, wfMessage(
'sf_createtemplate_aggregation' )->text() ) . "\n";
- $text .= "\t" . Html::element( 'p', null, wfMessage(
'sf_createtemplate_aggregationdesc' )->text() ) . "\n";
- $text .= "\t<p>" . wfMessage(
'sf_createtemplate_semanticproperty' )->escaped() . ' ' .
- self::printPropertiesComboBox( $all_properties,
"aggregation" ) . "</p>\n";
- $text .= "\t<p>" . wfMessage(
'sf_createtemplate_aggregationlabel' )->escaped() . ' ' .
- Html::input( 'aggregation_label', null, 'text',
- array( 'size' => '25' ) ) .
- "</p>\n";
- $text .= "\t</fieldset>\n";
+
+ if ( defined( 'SMW_VERSION' ) ) {
+ $text .= "\t<fieldset>\n";
+ $text .= "\t" . Html::element( 'legend', null,
wfMessage( 'sf_createtemplate_aggregation' )->text() ) . "\n";
+ $text .= "\t" . Html::element( 'p', null, wfMessage(
'sf_createtemplate_aggregationdesc' )->text() ) . "\n";
+ $text .= "\t<p>" . wfMessage(
'sf_createtemplate_semanticproperty' )->escaped() . ' ' .
+ self::printPropertiesComboBox( $all_properties,
"aggregation" ) . "</p>\n";
+ $text .= "\t<p>" . wfMessage(
'sf_createtemplate_aggregationlabel' )->escaped() . ' ' .
+ Html::input( 'aggregation_label', null, 'text',
+ array( 'size' => '25' ) ) .
+ "</p>\n";
+ $text .= "\t</fieldset>\n";
+ }
+
$text .= self::printTemplateStyleInput( 'template_format' );
$text .= "\t" . Html::hidden( 'csrf',
$this->getUser()->getEditToken( 'CreateTemplate' ) ) . "\n";
--
To view, visit https://gerrit.wikimedia.org/r/174048
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I24870f3bf40ddd8bca550070fc9c516f1be40fab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits