Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -686,16 +686,13 @@ |
687 | 687 | } |
688 | 688 | } elseif ( $sub_components[0] == 'autocomplete on property' ) { |
689 | 689 | $property_name = $sub_components[1]; |
690 | | - $propValue = SMWPropertyValue::makeUserProperty( $this->semantic_property ); |
691 | | - if ( $propValue->getPropertyID() == '_wpg' ) { |
| 690 | + $propValue = SMWPropertyValue::makeUserProperty( $property_name ); |
| 691 | + if ( $propValue->getPropertyTypeID() == '_wpg' ) { |
692 | 692 | $field_args['autocomplete field type'] = 'relation'; |
693 | 693 | } else { |
694 | 694 | $field_args['autocomplete field type'] = 'attribute'; |
695 | 695 | } |
696 | 696 | $field_args['autocompletion source'] = $sub_components[1]; |
697 | | - } elseif ( $sub_components[0] == 'autocomplete on' ) { // for backwards-compatibility |
698 | | - $field_args['autocomplete field type'] = 'category'; |
699 | | - $field_args['autocompletion source'] = $sub_components[1]; |
700 | 697 | } elseif ( $sub_components[0] == 'autocomplete on category' ) { |
701 | 698 | $field_args['autocomplete field type'] = 'category'; |
702 | 699 | $field_args['autocompletion source'] = $sub_components[1]; |
— | — | @@ -718,23 +715,27 @@ |
719 | 716 | // remove whitespaces, and un-escape characters |
720 | 717 | $possible_values = array_map( 'trim', explode( ',', $sub_components[1] ) ); |
721 | 718 | $possible_values = array_map( 'htmlspecialchars_decode', $possible_values ); |
| 719 | + } elseif ( $sub_components[0] == 'values from property' ) { |
| 720 | + $propertyName = $sub_components[1]; |
| 721 | + $propValue = SMWPropertyValue::makeUserProperty( $propertyName ); |
| 722 | + $isRelation = $propValue->getPropertyTypeID() == '_wpg'; |
| 723 | + $possible_values = SFAutocompleteAPI::getAllValuesForProperty( $isRelation, $propertyName ); |
722 | 724 | } elseif ( $sub_components[0] == 'values from category' ) { |
723 | 725 | $category_name = ucfirst( $sub_components[1] ); |
724 | 726 | $possible_values = SFUtils::getAllPagesForCategory( $category_name, 10 ); |
725 | 727 | } elseif ( $sub_components[0] == 'values from concept' ) { |
726 | 728 | $possible_values = SFUtils::getAllPagesForConcept( $sub_components[1] ); |
| 729 | + } elseif ( $sub_components[0] == 'values from namespace' ) { |
| 730 | + $possible_values = SFUtils::getAllPagesForNamespace( $sub_components[1] ); |
727 | 731 | } elseif ( $sub_components[0] == 'property' ) { |
728 | 732 | $semantic_property = $sub_components[1]; |
729 | 733 | } elseif ( $sub_components[0] == 'default filename' ) { |
730 | 734 | $default_filename = str_replace( '<page name>', $page_name, $sub_components[1] ); |
731 | 735 | $field_args['default filename'] = $default_filename; |
732 | | - } else { |
733 | | - $field_args[$sub_components[0]] = $sub_components[1]; |
734 | 736 | } |
735 | | - // for backwards compatibility |
736 | | - if ( $sub_components[0] == 'autocomplete on' && $sub_components[1] == null ) { |
737 | | - $field_args['no autocomplete'] = true; |
738 | | - } |
| 737 | + |
| 738 | + // Also set each value as its own entry in $field_args |
| 739 | + $field_args[$sub_components[0]] = $sub_components[1]; |
739 | 740 | } |
740 | 741 | } |
741 | 742 | } // end for |
— | — | @@ -1420,8 +1421,9 @@ |
1421 | 1422 | $other_args = $form_field->getArgumentsForInputCall(); |
1422 | 1423 | // special call to ensure that a list input is the right default size |
1423 | 1424 | if ( $form_field->is_list ) { |
1424 | | - if ( ! array_key_exists( 'size', $other_args ) ) |
| 1425 | + if ( ! array_key_exists( 'size', $other_args ) ) { |
1425 | 1426 | $other_args['size'] = 100; |
| 1427 | + } |
1426 | 1428 | } |
1427 | 1429 | $text = SFTextInput::getHTML( $cur_value, $form_field->input_name, $form_field->is_mandatory, $form_field->is_disabled, $other_args ); |
1428 | 1430 | } |