Index: trunk/extensions/SemanticForms/includes/SF_FormClasses.inc |
— | — | @@ -98,16 +98,11 @@ |
99 | 99 | // this is a two-dimensional array; we need the last three of the four |
100 | 100 | // sub-arrays; we also have to remove redundant values |
101 | 101 | foreach ($matches[1] as $i => $field_name) { |
102 | | - // in SMW 0.7, we determine from the markup tag whether it's a relation |
103 | | - $smw_version = SMW_VERSION; |
104 | | - if ($smw_version{0} == '0') |
105 | | - $is_relation = ($matches[3][$i] == "::"); |
106 | | - else |
107 | | - $is_relation = false; |
| 102 | + $is_relation = false; |
108 | 103 | $semantic_field_name = $matches[2][$i]; |
109 | 104 | $full_field_text = $matches[0][$i]; |
110 | 105 | if (! in_array($field_name, $field_names_array)) { |
111 | | - $template_field = SFTemplateField::newWithValues($field_name, ucfirst(strtolower($field_name))); |
| 106 | + $template_field = SFTemplateField::newWithValues($field_name, ucfirst($field_name)); |
112 | 107 | $template_field->setSemanticData($semantic_field_name, $is_relation, true); |
113 | 108 | $cur_pos = stripos($template_text, $full_field_text); |
114 | 109 | $template_fields[$cur_pos] = $template_field; |
— | — | @@ -123,16 +118,11 @@ |
124 | 119 | // this is a two-dimensional array; we need the last three of the four |
125 | 120 | // sub-arrays; we also have to remove redundant values |
126 | 121 | foreach ($matches[1] as $i => $semantic_field_name) { |
127 | | - // in SMW 0.7, we determine from the markup tag whether it's a relation |
128 | | - $smw_version = SMW_VERSION; |
129 | | - if ($smw_version{0} == '0') |
130 | | - $is_relation = ($matches[2][$i] == "::"); |
131 | | - else |
132 | | - $is_relation = false; |
| 122 | + $is_relation = false; |
133 | 123 | $field_name = $matches[3][$i]; |
134 | 124 | $full_field_text = $matches[0][$i]; |
135 | 125 | if (! in_array($field_name, $field_names_array)) { |
136 | | - $template_field = SFTemplateField::newWithValues($field_name, ucfirst(strtolower($field_name))); |
| 126 | + $template_field = SFTemplateField::newWithValues($field_name, ucfirst($field_name)); |
137 | 127 | $template_field->setSemanticData($semantic_field_name, $is_relation, false); |
138 | 128 | $cur_pos = stripos($template_text, $full_field_text); |
139 | 129 | $template_fields[$cur_pos] = $template_field; |
— | — | @@ -149,7 +139,7 @@ |
150 | 140 | $full_field_text = $matches[0][$i]; |
151 | 141 | if (($full_field_text != '') && (! in_array($field_name, $field_names_array))) { |
152 | 142 | $cur_pos = stripos($template_text, $full_field_text); |
153 | | - $template_fields[$cur_pos] = SFTemplateField::newWithValues($field_name, ucfirst(strtolower($field_name))); |
| 143 | + $template_fields[$cur_pos] = SFTemplateField::newWithValues($field_name, ucfirst($field_name)); |
154 | 144 | $field_names_array[] = $field_name; |
155 | 145 | } |
156 | 146 | } |
— | — | @@ -296,35 +286,21 @@ |
297 | 287 | function possibleInputTypes($semantic_field_type, $is_list) { |
298 | 288 | // first, get the list of field types, to determine which one this is |
299 | 289 | global $smwgContLang; |
300 | | - $smw_version = SMW_VERSION; |
301 | | - if ($smw_version{0} == '0') { |
302 | | - $string_type = $smwgContLang->getDatatypeLabel('smw_string'); |
303 | | - $text_type = 'text'; // placeholder - SMW 1.0+ type only |
304 | | - $url_type = $smwgContLang->getDatatypeLabel('smw_url'); |
305 | | - $email_type = $smwgContLang->getDatatypeLabel('smw_email'); |
306 | | - $float_type = $smwgContLang->getDatatypeLabel('smw_float'); |
307 | | - $int_type = $smwgContLang->getDatatypeLabel('smw_int'); |
308 | | - $bool_type = $smwgContLang->getDatatypeLabel('smw_bool'); |
309 | | - $date_type = $smwgContLang->getDatatypeLabel('smw_datetime'); |
310 | | - $enum_type = $smwgContLang->getDatatypeLabel('smw_enum'); |
311 | | - $page_type = 'relation'; |
312 | | - } else { |
313 | | - $datatypeLabels = $smwgContLang->getDatatypeLabels(); |
314 | | - $string_type = $datatypeLabels['_str']; |
315 | | - $text_type = $datatypeLabels['_txt']; |
316 | | - $url_type = $datatypeLabels['_uri']; |
317 | | - $email_type = $datatypeLabels['_ema']; |
318 | | - $float_type = $datatypeLabels['_num']; |
319 | | - $int_type = $datatypeLabels['_num']; |
320 | | - // some old versions of SMW 1.0 don't support Boolean types |
321 | | - if (array_key_exists('_boo', $datatypeLabels)) |
322 | | - $bool_type = $datatypeLabels['_boo']; |
323 | | - else |
324 | | - $bool_type = 'boolean'; |
325 | | - $date_type = $datatypeLabels['_dat']; |
326 | | - $enum_type = 'enumeration'; // not a real type in SMW 1.0 |
327 | | - $page_type = $datatypeLabels['_wpg']; |
328 | | - } |
| 290 | + $datatypeLabels = $smwgContLang->getDatatypeLabels(); |
| 291 | + $string_type = $datatypeLabels['_str']; |
| 292 | + $text_type = $datatypeLabels['_txt']; |
| 293 | + $url_type = $datatypeLabels['_uri']; |
| 294 | + $email_type = $datatypeLabels['_ema']; |
| 295 | + $float_type = $datatypeLabels['_num']; |
| 296 | + $int_type = $datatypeLabels['_num']; |
| 297 | + // some old versions of SMW 1.0 don't support Boolean types |
| 298 | + if (array_key_exists('_boo', $datatypeLabels)) |
| 299 | + $bool_type = $datatypeLabels['_boo']; |
| 300 | + else |
| 301 | + $bool_type = 'boolean'; |
| 302 | + $date_type = $datatypeLabels['_dat']; |
| 303 | + $enum_type = 'enumeration'; // not a real type in SMW 1.0 |
| 304 | + $page_type = $datatypeLabels['_wpg']; |
329 | 305 | |
330 | 306 | // then, return the array of possible input types, depending on the |
331 | 307 | // field type and whether this field will contain multiple values |
— | — | @@ -381,40 +357,18 @@ |
382 | 358 | $field_form_text = $template_num . "_" . $this->num; |
383 | 359 | $template_field = $this->template_field; |
384 | 360 | $text = '<h3>' . wfMsg('sf_createform_field') . " '" . $template_field->field_name . "'</h3>\n"; |
385 | | - $smw_version = SMW_VERSION; |
386 | | - if ($smw_version{0} == "0") { |
387 | | - if ($template_field->is_relation) { |
388 | | - $rel_link_text = sffLinkText(SMW_NS_RELATION, $template_field->semantic_field); |
389 | | - if ($template_field->is_list) |
390 | | - $text .= '<p>' . wfMsg('sf_createform_fieldrellist', $rel_link_text) . "</p>\n"; |
391 | | - else |
392 | | - $text .= '<p>' . wfMsg('sf_createform_fieldrel', $rel_link_text) . "</p>\n"; |
393 | | - } elseif ($template_field->field_type != null) { |
394 | | - $attr_link_text = sffLinkText(SMW_NS_ATTRIBUTE, $template_field->semantic_field); |
395 | | - // TODO - remove this probably-unnecessary check? |
396 | | - if ($template_field->field_type == "") |
397 | | - $text .= '<p>' . wfMsg('sf_createform_fieldattrunknowntype', $attr_link_text) . "</p>\n"; |
398 | | - elseif ($template_field->is_list) |
399 | | - $text .= '<p>' . wfMsg('sf_createform_fieldattrlist', $attr_link_text, |
400 | | - sffLinkText(SMW_NS_TYPE, $template_field->field_type)) . "</p>\n"; |
401 | | - else |
402 | | - $text .= '<p>' . wfMsg('sf_createform_fieldattr', $attr_link_text, |
403 | | - sffLinkText(SMW_NS_TYPE, $template_field->field_type)) . "</p>\n"; |
404 | | - } |
405 | | - } else { |
406 | | - $prop_link_text = sffLinkText(SMW_NS_PROPERTY, $template_field->semantic_field); |
407 | | - // TODO - remove this probably-unnecessary check? |
408 | | - if ($template_field->semantic_field == "") { |
409 | | - // print nothing if there's no semantic field |
410 | | - } elseif ($template_field->field_type == "") |
411 | | - $text .= '<p>' . wfMsg('sf_createform_fieldpropunknowntype', $prop_link_text) . "</p>\n"; |
412 | | - elseif ($template_field->is_list) |
413 | | - $text .= '<p>' . wfMsg('sf_createform_fieldproplist', $prop_link_text, |
414 | | - sffLinkText(SMW_NS_TYPE, $template_field->field_type)) . "</p>\n"; |
415 | | - else |
416 | | - $text .= '<p>' . wfMsg('sf_createform_fieldprop', $prop_link_text, |
417 | | - sffLinkText(SMW_NS_TYPE, $template_field->field_type)) . "</p>\n"; |
418 | | - } |
| 361 | + $prop_link_text = sffLinkText(SMW_NS_PROPERTY, $template_field->semantic_field); |
| 362 | + // TODO - remove this probably-unnecessary check? |
| 363 | + if ($template_field->semantic_field == "") { |
| 364 | + // print nothing if there's no semantic field |
| 365 | + } elseif ($template_field->field_type == "") |
| 366 | + $text .= '<p>' . wfMsg('sf_createform_fieldpropunknowntype', $prop_link_text) . "</p>\n"; |
| 367 | + elseif ($template_field->is_list) |
| 368 | + $text .= '<p>' . wfMsg('sf_createform_fieldproplist', $prop_link_text, |
| 369 | + sffLinkText(SMW_NS_TYPE, $template_field->field_type)) . "</p>\n"; |
| 370 | + else |
| 371 | + $text .= '<p>' . wfMsg('sf_createform_fieldprop', $prop_link_text, |
| 372 | + sffLinkText(SMW_NS_TYPE, $template_field->field_type)) . "</p>\n"; |
419 | 373 | // if it's not a semantic field - don't add any text |
420 | 374 | $form_label_text = wfMsg('sf_createform_formlabel'); |
421 | 375 | $field_label = $template_field->label; |