Index: trunk/extensions/SemanticForms/includes/SF_TemplateField.inc |
— | — | @@ -24,47 +24,7 @@ |
25 | 25 | return $f; |
26 | 26 | } |
27 | 27 | |
28 | | - function setTypeAndPossibleValues_0_7() { |
29 | | - // HACK - set type (to 'relation') if it's a relation |
30 | | - if ($this->is_relation) { |
31 | | - $this->field_type = 'relation'; |
32 | | - return; |
33 | | - } |
34 | | - |
35 | | - global $smwgContLang; |
36 | | - $fname = 'SFTemplateField::getPossibleValues'; |
37 | | - |
38 | | - $db = wfGetDB( DB_SLAVE ); |
39 | | - // value has underscores in the database |
40 | | - $semantic_field_db_str = str_replace(' ', '_', $this->semantic_field); |
41 | | - $conditions = "subject_namespace = " . SMW_NS_ATTRIBUTE . " AND subject_title = '$semantic_field_db_str' AND property_id = 1"; |
42 | | - $res = $db->select( $db->tableName('smw_specialprops'), |
43 | | - 'value_string', |
44 | | - $conditions, $fname); |
45 | | - if ($db->numRows( $res ) > 0) { |
46 | | - if ($row = $db->fetchObject($res)) { |
47 | | - $this->field_type = $row->value_string; |
48 | | - // set possible values if it's an enumeration |
49 | | - if ($this->field_type == $smwgContLang->getDatatypeLabel('smw_enum')) { |
50 | | - $conditions = "subject_namespace = " . SMW_NS_ATTRIBUTE . |
51 | | - " AND subject_title = '$semantic_field_db_str' AND property_id = " . |
52 | | - SMW_SP_POSSIBLE_VALUE; |
53 | | - $res2 = $db->select( $db->tableName('smw_specialprops'), |
54 | | - 'value_string', $conditions, $fname); |
55 | | - if ($db->numRows( $res2 ) > 0) { |
56 | | - while ($row = $db->fetchObject($res2)) { |
57 | | - $this->possible_values[] = $row->value_string; |
58 | | - } |
59 | | - } |
60 | | - $db->freeResult($res2); |
61 | | - } |
62 | | - } |
63 | | - } |
64 | | - $db->freeResult($res); |
65 | | - return array(); |
66 | | - } |
67 | | - |
68 | | - function setTypeAndPossibleValues_1_0() { |
| 28 | + function setTypeAndPossibleValues() { |
69 | 29 | $proptitle = Title::newFromText($this->semantic_field, SMW_NS_PROPERTY); |
70 | 30 | if ($proptitle === NULL) |
71 | 31 | return; |
— | — | @@ -100,12 +60,7 @@ |
101 | 61 | $this->possible_values = array(); |
102 | 62 | $this->is_list = $is_list; |
103 | 63 | // set field type and possible values, if any |
104 | | - $smw_version = SMW_VERSION; |
105 | | - if ($smw_version{0} == '0') { |
106 | | - $this->setTypeAndPossibleValues_0_7(); |
107 | | - } else { |
108 | | - $this->setTypeAndPossibleValues_1_0(); |
109 | | - } |
| 64 | + $this->setTypeAndPossibleValues(); |
110 | 65 | } |
111 | 66 | } |
112 | 67 | |