r60305 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60304‎ | r60305 | r60306 >
Date:05:27, 23 December 2009
Author:yaron
Status:deferred
Tags:
Comment:
Replaced some hardcoded HTML with calls to Xml class functions
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_CreateCategory.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateCategory.php
@@ -113,7 +113,7 @@
114114 END;
115115 foreach ($categories as $category) {
116116 $category = str_replace('_', ' ', $category);
117 - $text .= " <option>$category</option>\n";
 117+ $text .= " " . Xml::element('option', null, $category) . "\n";
118118 }
119119 $text .=<<<END
120120 </select>
@@ -123,10 +123,10 @@
124124 <input type="submit" id="wpPreview" name="wpPreview" value="$preview_button_text"></p>
125125 </div>
126126 <br /><hr /<br />
127 - <p>$create_form_link.</p>
128127
129128 END;
130129
 130+ $text .= " " . Xml::tags('p', null, $create_form_link . '.') . "\n";
131131 $text .= " </form>\n";
132132
133133 $wgOut->addLink( array(
Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -142,38 +142,31 @@
143143 $text .= ' <input type="hidden" name="title" value="' . $special_namespace . ':CreateForm">' . "\n";
144144 $text .= ' <p>' . wfMsg('sf_createform_nameinput') . ' ' . wfMsg('sf_createform_nameinputdesc') . ' <input size=25 name="form_name" value="' . $form_name . '">';
145145 if (! empty($form_name_error_str))
146 - $text .= ' <font color="red">' . $form_name_error_str . '</font>';
 146+ $text .= ' ' . Xml::element('font', array('color' => 'red'), $form_name_error_str);
147147 $text .= "</p>\n";
148148
149149 $text .= $form->creationHTML();
150150
151151 $text .= ' <p>' . wfMsg('sf_createform_addtemplate') . "\n";
152 - $text .= ' <select name="new_template">' . "\n";
153152
 153+ $select_body = "";
154154 foreach ($all_templates as $template) {
155 - $text .= " <option value=\"$template\">$template</option>\n";
 155+ $select_body .= " " . Xml::element('option', array('value' => $template), $template) . "\n";
156156 }
157 -
158 - $text .= " </select>\n";
 157+ $text .= ' ' . Xml::tags('select', array('name' => 'new_template'), $select_body) . "\n";
159158 // if a template has already been added, show a dropdown letting the
160159 // user choose where in the list to add a new dropdown
161160 if (count($form_templates) > 0) {
162161 $before_template_msg = wfMsg('sf_createform_beforetemplate');
163 - $at_end_msg = wfMsg('sf_createform_atend');
164 - $text .=<<<END
165 - $before_template_msg
166 - <select name="before_template">
167 -
168 -END;
 162+ $text .= $before_template_msg;
 163+ $select_body = "";
169164 foreach ($form_templates as $i => $ft) {
170 - $text .= " <option value=\"$i\">{$ft->template_name}</option>\n";
 165+ $select_body .= " " . Xml::element('option', array('value' => $i), $ft->template_name) . "\n";
171166 }
172167 $final_index = count($form_templates);
173 - $text .=<<<END
174 - <option value="$final_index" selected="selected">$at_end_msg</option>
175 - </select>
176 -
177 -END;
 168+ $at_end_msg = wfMsg('sf_createform_atend');
 169+ $select_body .= ' ' . Xml::element('option', array('value' => $final_index, 'selected' => 'selected'), $at_end_msg);
 170+ $text .= Xml::tags('select', array('name' => 'before_template'), $select_body) . "\n";
178171 }
179172
180173 // disable 'save' and 'preview' buttons if user has not yet added any
@@ -199,14 +192,14 @@
200193 // explanatory message if buttons are disabled because no templates
201194 // have been added
202195 if (count($form_templates) == 0) {
203 - $text .= " <p>(" . wfMsg('sf_createtemplate_addtemplatebeforesave') . ")</p>";
 196+ $text .= " " . Xml::element('p', null, "(" . wfMsg('sf_createtemplate_addtemplatebeforesave') . ")");
204197 }
205198 $text .=<<<END
206199 </form>
207200 <hr /><br />
208 - <p>$create_template_link.</p>
209201
210202 END;
 203+ $text .= " " . Xml::tags('p', null, $create_template_link . '.');
211204
212205 $wgOut->addLink( array(
213206 'rel' => 'stylesheet',
Index: trunk/extensions/SemanticForms/specials/SF_CreateProperty.php
@@ -119,16 +119,16 @@
120120 <p>$name_label <input size="25" name="property_name" value="">
121121 <span style="color: red;">$property_name_error_str</span>
122122 $type_label
123 - <select id="property_dropdown" name="property_type" onChange="toggleDefaultForm(this.value);">
124123 END;
 124+ $select_body = "";
125125 foreach ($datatype_labels as $label) {
126 - $text .= " <option>$label</option>\n";
 126+ $select_body .= " " . Xml::element('option', null, $label) . "\n";
127127 }
 128+ $text .= Xml::tags('select', array('id' => 'property_dropdown', 'name' => 'property_type', 'onChange' => 'toggleDefaultForm(this.value);'), $select_body) . "\n";
128129
129130 $default_form_input = wfMsg('sf_createproperty_linktoform');
130131 $values_input = wfMsg('sf_createproperty_allowedvalsinput');
131132 $text .=<<<END
132 - </select>
133133 <div id="default_form_div" style="padding: 5px 0 5px 0; margin: 7px 0 7px 0;">
134134 <p>$default_form_input
135135 <input size="20" name="default_form" value=""></p>
@@ -137,13 +137,13 @@
138138 <p>$values_input</p>
139139 <p><input size="80" name="values" value=""></p>
140140 </div>
141 - <div class="editButtons">
142 - <input id="wpSave" type="submit" name="wpSave" value="$save_button_text">
143 - <input id="wpPreview" type="submit" name="wpPreview" value="$preview_button_text">
144 - </div>
145 - </form>
146141
147142 END;
 143+ $edit_buttons = ' ' . Xml::element('input', array('id' => 'wpSave', 'type' => 'submit', 'name' => 'wpSave', 'value' => $save_button_text));
 144+ $edit_buttons .= ' ' . Xml::element('input', array('id' => 'wpPreview', 'type' => 'submit', 'name' => 'wpPreview', 'value' => $preview_button_text));
 145+ $text .= ' ' . Xml::tags('div', array('class' => 'editButtons'), $edit_buttons) . "\n";
 146+ $text .= " </form>\n";
 147+
148148 $wgOut->addLink( array(
149149 'rel' => 'stylesheet',
150150 'type' => 'text/css',

Status & tagging log