r36739 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36738‎ | r36739 | r36740 >
Date:13:16, 27 June 2008
Author:yaron
Status:old
Tags:
Comment:
Removed setTypeAndPossibleValues_0_7() (part of general removal of SMW-0.7-compatible code)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_TemplateField.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_TemplateField.inc
@@ -24,47 +24,7 @@
2525 return $f;
2626 }
2727
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() {
6929 $proptitle = Title::newFromText($this->semantic_field, SMW_NS_PROPERTY);
7030 if ($proptitle === NULL)
7131 return;
@@ -100,12 +60,7 @@
10161 $this->possible_values = array();
10262 $this->is_list = $is_list;
10363 // 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();
11065 }
11166 }
11267

Status & tagging log