r89333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89332‎ | r89333 | r89334 >
Date:13:32, 2 June 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fixed display of types in Special:CreateForm, now that TemplateField 'field_type' field has been replaced with 'property_type', and given that types no longer have their own page in SMW 1.6
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormField.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormField.php
@@ -123,15 +123,32 @@
124124 $prop_link_text = SFUtils::linkText( SMW_NS_PROPERTY, $template_field->semantic_property );
125125 // TODO - remove this probably-unnecessary check?
126126 if ( $template_field->semantic_property == "" ) {
127 - // print nothing if there's no semantic field
128 - } elseif ( $template_field->field_type == "" ) {
 127+ // Print nothing if there's no semantic property.
 128+ } elseif ( $template_field->property_type == "" ) {
129129 $text .= '<p>' . wfMsg( 'sf_createform_fieldpropunknowntype', $prop_link_text ) . "</p>\n";
130 - } elseif ( $template_field->is_list ) {
131 - $text .= '<p>' . wfMsg( 'sf_createform_fieldproplist', $prop_link_text,
132 - SFUtils::linkText( SMW_NS_TYPE, $template_field->field_type ) ) . "</p>\n";
133130 } else {
134 - $text .= '<p>' . wfMsg( 'sf_createform_fieldprop', $prop_link_text,
135 - SFUtils::linkText( SMW_NS_TYPE, $template_field->field_type ) ) . "</p>\n";
 131+ if ( $template_field->is_list ) {
 132+ $propDisplayMsg = 'sf_createform_fieldproplist';
 133+ } else {
 134+ $propDisplayMsg = 'sf_createform_fieldprop';
 135+ }
 136+
 137+ // Get the display label for this property type.
 138+ global $smwgContLang;
 139+ $propertyTypeStr = '';
 140+ if ( $smwgContLang != null ) {
 141+ $datatypeLabels = $smwgContLang->getDatatypeLabels();
 142+ $datatypeLabels['enumeration'] = 'enumeration';
 143+ $propertyType = $datatypeLabels[$template_field->property_type];
 144+ if ( class_exists( 'SMWDIProperty' ) ) {
 145+ // "Type:" namespace was removed in SMW 1.6.
 146+ // TODO: link to Special:Types instead?
 147+ $propertyTypeStr = $propertyType;
 148+ } else {
 149+ $propertyTypeStr = SFUtils::linkText( SMW_NS_TYPE, $propertyType );
 150+ }
 151+ }
 152+ $text .= Xml::tags( 'p', null, wfMsg( $propDisplayMsg, $prop_link_text, $propertyTypeStr ) ) . "\n";
136153 }
137154 // If it's not a semantic field - don't add any text.
138155 $form_label_text = wfMsg( 'sf_createform_formlabel' );