r43646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43645‎ | r43646 | r43647 >
Date:22:12, 17 November 2008
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for SMW 1.4
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_TemplateField.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_TemplateField.inc
@@ -29,14 +29,20 @@
3030 if ($proptitle === NULL)
3131 return;
3232 $store = smwfGetStore();
33 - $types = $store->getSpecialValues($proptitle, SMW_SP_HAS_TYPE);
 33+ if (class_exists('SMWPropertyValue')) {
 34+ $types = $store->getPropertyValues($proptitle, SMWPropertyValue::makeUserProperty("Has type"));
 35+ // this returns an array of objects
 36+ $allowed_values = $store->getPropertyValues($proptitle, SMWPropertyValue::makeUserProperty("Allows value"));
 37+ } else {
 38+ $types = $store->getSpecialValues($proptitle, SMW_SP_HAS_TYPE);
 39+ // this returns an array of objects
 40+ $allowed_values = $store->getSpecialValues($proptitle, SMW_SP_POSSIBLE_VALUE);
 41+ }
3442 // TODO - need handling for the case of more than one type
3543 if (count($types) > 0)
3644 $this->field_type = $types[0]->getWikiValue();
3745
38 - // this returns an array of objects
39 - $SMW_values = smwfGetStore()->getSpecialValues($proptitle, SMW_SP_POSSIBLE_VALUE);
40 - foreach ($SMW_values as $value) {
 46+ foreach ($allowed_values as $value) {
4147 $this->possible_values[] = $value->getXSDValue();
4248 }
4349 // HACK - if there were any possible values, set the field

Status & tagging log