Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -25,43 +25,28 @@ |
26 | 26 | // in the form definition |
27 | 27 | $this->mSemanticTypeHooks = array(); |
28 | 28 | 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']; |
42 | 39 | } 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 |
65 | 42 | } |
| 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']; |
66 | 51 | $this->setSemanticTypeHook($string_type, false, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'string')); |
67 | 52 | $this->setSemanticTypeHook($string_type, true, array('SFFormInputs', 'textEntryHTML'), array('field_type' => 'string', 'is_list' => 'true')); |
68 | 53 | $this->setSemanticTypeHook($text_type, false, array('SFFormInputs', 'textAreaHTML'), array()); |
— | — | @@ -561,15 +546,10 @@ |
562 | 547 | // possibilities get added |
563 | 548 | if (count($cur_value) == 1) { |
564 | 549 | $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 |
566 | 551 | // 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; |
574 | 554 | if (count($words_for_false) > $index_of_no) { |
575 | 555 | $no = ucwords($words_for_false[$index_of_no]); |
576 | 556 | } elseif (count($words_for_false) == 0) { |
— | — | @@ -581,13 +561,8 @@ |
582 | 562 | } elseif (count($cur_value) == 2) { |
583 | 563 | $words_for_true = explode(',', wfMsgForContent('smw_true_words')); |
584 | 564 | // 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; |
592 | 567 | if (count($words_for_true) > $index_of_yes) { |
593 | 568 | $yes = ucwords($words_for_true[$index_of_yes]); |
594 | 569 | } elseif (count($words_for_true) == 0) { |