r36740 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36739‎ | r36740 | r36741 >
Date:13:18, 27 June 2008
Author:yaron
Status:old
Tags:
Comment:
Removed SMW-0.7-specific code
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -25,43 +25,28 @@
2626 // in the form definition
2727 $this->mSemanticTypeHooks = array();
2828 if ($smwgContLang != null) {
29 - // set type strings based on the SMW version
30 - $smw_version = SMW_VERSION;
31 - if ($smw_version{0} == '0') {
32 - $string_type = $smwgContLang->getDatatypeLabel('smw_string');
33 - $text_type = 'text'; // placeholder - SMW 1.0+ only
34 - $url_type = $smwgContLang->getDatatypeLabel('smw_url');
35 - $email_type = $smwgContLang->getDatatypeLabel('smw_email');
36 - $float_type = $smwgContLang->getDatatypeLabel('smw_float');
37 - $int_type = $smwgContLang->getDatatypeLabel('smw_int');
38 - $bool_type = $smwgContLang->getDatatypeLabel('smw_bool');
39 - $date_type = $smwgContLang->getDatatypeLabel('smw_datetime');
40 - $enum_type = $smwgContLang->getDatatypeLabel('smw_enum');
41 - $page_type = 'relation';
 29+ $datatypeLabels = $smwgContLang->getDatatypeLabels();
 30+ $string_type = $datatypeLabels['_str'];
 31+ $text_type = $datatypeLabels['_txt'];
 32+ $url_type = $datatypeLabels['_uri'];
 33+ $email_type = $datatypeLabels['_ema'];
 34+ // backwards compatibility with SMW 1.0 alpha 1 - still used, for
 35+ // now, by the Halo extension
 36+ if (array_key_exists('_flt', $datatypeLabels)) {
 37+ $float_type = $datatypeLabels['_flt'];
 38+ $int_type = $datatypeLabels['_int'];
4239 } else {
43 - $datatypeLabels = $smwgContLang->getDatatypeLabels();
44 - $string_type = $datatypeLabels['_str'];
45 - $text_type = $datatypeLabels['_txt'];
46 - $url_type = $datatypeLabels['_uri'];
47 - $email_type = $datatypeLabels['_ema'];
48 - // backwards compatibility with SMW 1.0 alpha 1 - still used, for
49 - // now, by the Halo extension
50 - if (array_key_exists('_flt', $datatypeLabels)) {
51 - $float_type = $datatypeLabels['_flt'];
52 - $int_type = $datatypeLabels['_int'];
53 - } else {
54 - $float_type = $datatypeLabels['_num'];
55 - $int_type = 'integer'; // placeholder - no longer exists
56 - }
57 - // some old versions of SMW 1.0 don't support Boolean types
58 - if (array_key_exists('_boo', $datatypeLabels))
59 - $bool_type = $datatypeLabels['_boo'];
60 - else
61 - $bool_type = 'boolean';
62 - $date_type = $datatypeLabels['_dat'];
63 - $enum_type = 'enumeration'; // not a real type
64 - $page_type = $datatypeLabels['_wpg'];
 40+ $float_type = $datatypeLabels['_num'];
 41+ $int_type = 'integer'; // placeholder - no longer exists
6542 }
 43+ // some old versions of SMW 1.0 don't support Boolean types
 44+ if (array_key_exists('_boo', $datatypeLabels))
 45+ $bool_type = $datatypeLabels['_boo'];
 46+ else
 47+ $bool_type = 'boolean';
 48+ $date_type = $datatypeLabels['_dat'];
 49+ $enum_type = 'enumeration'; // not a real type
 50+ $page_type = $datatypeLabels['_wpg'];
6651 $this->setSemanticTypeHook($string_type, false, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'string'));
6752 $this->setSemanticTypeHook($string_type, true, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'string', 'is_list' => 'true'));
6853 $this->setSemanticTypeHook($text_type, false, array('SFFormInputs', 'textAreaHTML'), array());
@@ -561,15 +546,10 @@
562547 // possibilities get added
563548 if (count($cur_value) == 1) {
564549 $words_for_false = explode(',', wfMsgForContent('smw_false_words'));
565 - // for each languages, there's a series of words that are
 550+ // for each language, there's a series of words that are
566551 // equal to false - get the word in the series that matches
567 - // "no"; for SMW 0.7, that's the 2nd word, and for SMW 1.0
568 - // it's the third word
569 - $smw_version = SMW_VERSION;
570 - if ($smw_version{0} == '0')
571 - $index_of_no = 1;
572 - else
573 - $index_of_no = 2;
 552+ // "no"; generally, that's the third word
 553+ $index_of_no = 2;
574554 if (count($words_for_false) > $index_of_no) {
575555 $no = ucwords($words_for_false[$index_of_no]);
576556 } elseif (count($words_for_false) == 0) {
@@ -581,13 +561,8 @@
582562 } elseif (count($cur_value) == 2) {
583563 $words_for_true = explode(',', wfMsgForContent('smw_true_words'));
584564 // get the value in the 'true' series that tends to be "yes",
585 - // and go with that one - for SMW 0.7, that's the 2nd word,
586 - // and for SMW 1.0 it's the third word
587 - $smw_version = SMW_VERSION;
588 - if ($smw_version{0} == '0')
589 - $index_of_yes = 1;
590 - else
591 - $index_of_yes = 2;
 565+ // and go with that one - generally, that's the third word
 566+ $index_of_yes = 2;
592567 if (count($words_for_true) > $index_of_yes) {
593568 $yes = ucwords($words_for_true[$index_of_yes]);
594569 } elseif (count($words_for_true) == 0) {

Status & tagging log