r44401 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44400‎ | r44401 | r44402 >
Date:15:27, 10 December 2008
Author:yaron
Status:deferred
Tags:
Comment:
Removed handling of SMW 0.7, fixed handling of special properties for SMW 1.4
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_CreateProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateProperty.php
@@ -29,30 +29,31 @@
3030
3131 wfLoadExtensionMessages('SemanticForms');
3232
33 - $namespace_labels = $smwgContLang->getNamespaces();
34 - if ($property_type == $namespace_labels[SMW_NS_RELATION]) {
35 - $text = wfMsgForContent('sf_property_isrelation');
 33+ // handling of special property labels changed in SMW 1.4
 34+ if (method_exists($smwgContLang, 'getPropertyLabels')) {
 35+ $prop_labels = $smwgContLang->getPropertyLabels();
 36+ $type_tag = "[[{$prop_labels['_TYPE']}::$property_type]]";
3637 } else {
37 - global $smwgContLang;
38 - if (class_exists('SMWPropertyValue')) {
39 - $has_type_prop = SMWPropertyValue::makeUserProperty("Has type");
40 - $type_tag = "[[{$has_type_prop->getWikiValue()}::$property_type]]";
41 - } else {
42 - $specprops = $smwgContLang->getSpecialPropertiesArray();
43 - $type_tag = "[[{$specprops[SMW_SP_HAS_TYPE]}::$property_type]]";
44 - }
45 - $text = wfMsgForContent('sf_property_isproperty', $type_tag);
46 - if ($allowed_values_str != '') {
47 - $text .= "\n\n" . wfMsgForContent('sf_property_allowedvals');
48 - // replace the comma substitution character that has no chance of
49 - // being included in the values list - namely, the ASCII beep
50 - global $sfgListSeparator;
51 - $allowed_values_str = str_replace("\\$sfgListSeparator", "\a", $allowed_values_str);
52 - $allowed_values_array = explode($sfgListSeparator, $allowed_values_str);
53 - foreach ($allowed_values_array as $i => $value) {
54 - // replace beep back with comma, trim
55 - $value = str_replace("\a", $sfgListSeparator, trim($value));
56 - $text .= "\n* [[" . $specprops[SMW_SP_POSSIBLE_VALUE] . "::$value]]";
 38+ $spec_props = $smwgContLang->getSpecialPropertiesArray();
 39+ $type_tag = "[[{$spec_props[SMW_SP_HAS_TYPE]}::$property_type]]";
 40+ }
 41+ $text = wfMsgForContent('sf_property_isproperty', $type_tag);
 42+ if ($allowed_values_str != '') {
 43+ $text .= "\n\n" . wfMsgForContent('sf_property_allowedvals');
 44+ // replace the comma substitution character that has no chance of
 45+ // being included in the values list - namely, the ASCII beep
 46+ global $sfgListSeparator;
 47+ $allowed_values_str = str_replace("\\$sfgListSeparator", "\a", $allowed_values_str);
 48+ $allowed_values_array = explode($sfgListSeparator, $allowed_values_str);
 49+ foreach ($allowed_values_array as $i => $value) {
 50+ // replace beep back with comma, trim
 51+ $value = str_replace("\a", $sfgListSeparator, trim($value));
 52+ if (method_exists($smwgContLang, 'getPropertyLabels')) {
 53+ $prop_labels = $smwgContLang->getPropertyLabels();
 54+ $text .= "\n* [[" . $prop_labels['_PVAL'] . "::$value]]";
 55+ } else {
 56+ $spec_props = $smwgContLang->getSpecialPropertiesArray();
 57+ $text .= "\n* [[" . $spec_props[SMW_SP_POSSIBLE_VALUE] . "::$value]]";
5758 }
5859 }
5960 }

Status & tagging log