r97025 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97024‎ | r97025 | r97026 >
Date:00:09, 14 September 2011
Author:yaron
Status:ok
Tags:
Comment:
Some bug fixes
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_PageSchemas.php
@@ -86,19 +86,31 @@
8787 } else {
8888 $prop_array = array();
8989 }
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+ }
91102 $select_body = "";
92103 foreach ( $datatype_labels as $label ) {
93104 $optionAttrs = array();
94 - if ( $label == $prop_array['Type'] ) {
 105+ if ( $label == $propType) {
95106 $optionAttrs['selected'] = 'selected';
96107 }
97108 $select_body .= "\t" . Xml::element( 'option', $optionAttrs, $label ) . "\n";
98109 }
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+ );
103115 $html_text .= "Type: " . Xml::tags( 'select', $propertyDropdownAttrs, $select_body ) . "</p>\n";
104116 $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>';
105117 $allowedValsInputAttrs = array(

Status & tagging log