Index: trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php |
— | — | @@ -86,19 +86,31 @@ |
87 | 87 | } else { |
88 | 88 | $prop_array = array(); |
89 | 89 | } |
90 | | - $html_text = '<p>Property name: <input size="15" name="smw_property_name_num" value="'.$prop_array['name'].'" >' . "\n"; |
| 90 | + $html_text = '<p>Property name: '; |
| 91 | + if ( array_key_exists( 'name', $prop_array ) ) { |
| 92 | + $propName = $prop_array['name']; |
| 93 | + } else { |
| 94 | + $propName = null; |
| 95 | + } |
| 96 | + $html_text .= Html::input( 'smw_property_name_num', $propName, array( 'size' => 15 ) ) . "\n"; |
| 97 | + if ( array_key_exists( 'Type', $prop_array ) ) { |
| 98 | + $propType = $prop_array['Type']; |
| 99 | + } else { |
| 100 | + $propType = null; |
| 101 | + } |
91 | 102 | $select_body = ""; |
92 | 103 | foreach ( $datatype_labels as $label ) { |
93 | 104 | $optionAttrs = array(); |
94 | | - if ( $label == $prop_array['Type'] ) { |
| 105 | + if ( $label == $propType) { |
95 | 106 | $optionAttrs['selected'] = 'selected'; |
96 | 107 | } |
97 | 108 | $select_body .= "\t" . Xml::element( 'option', $optionAttrs, $label ) . "\n"; |
98 | 109 | } |
99 | | - $propertyDropdownAttrs = array( 'id' => 'property_dropdown', 'name' => 'smw_property_type_num' ); |
100 | | - if ( array_key_exists( 'Type', $prop_array ) ) { |
101 | | - $propertyDropdownAttrs['value'] = $prop_array['Type']; |
102 | | - } |
| 110 | + $propertyDropdownAttrs = array( |
| 111 | + 'id' => 'property_dropdown', |
| 112 | + 'name' => 'smw_property_type_num', |
| 113 | + 'value' => $propType |
| 114 | + ); |
103 | 115 | $html_text .= "Type: " . Xml::tags( 'select', $propertyDropdownAttrs, $select_body ) . "</p>\n"; |
104 | 116 | $html_text .= '<p>If you want this property to only be allowed to have certain values, enter the list of allowed values, separated by commas (if a value contains a comma, replace it with "\,"):</p>'; |
105 | 117 | $allowedValsInputAttrs = array( |