- function createWidget_StrList() {
- /* Begin the select tag. */
- $result = "<select name=\"new_$this->name\">";
-
- /* Add each possible value to the select list. */
- foreach ($this->possible_values as $real_value => $disp_value) {
- /* Start the next new option string. */
- $new_option = "<option value=\"$real_value\"";
-
- /* If this value is the current value, select it. */
- if ($real_value == $this->value) {
- $new_option .= ' selected';
+ /**
+ * Create selection box or radio button group
+ *
+ * When $this->htmlencoded is TRUE, the keys and values in
+ * $this->possible_values are assumed to be display-safe.
+ * Use with care!
+ *
+ * Note that when building radio buttons instead of a select
+ * widget, if the "size" attribute is SMOPT_SIZE_TINY, the
+ * radio buttons will be output one after another without
+ * linebreaks between them. Otherwise, each radio button
+ * goes on a line of its own.
+ *
+ * @param boolean $multiple_select When TRUE, the select widget
+ * will allow multiple selections
+ * (OPTIONAL; default is FALSE
+ * (single select list))
+ * @param boolean $radio_buttons When TRUE, the widget will
+ * instead be built as a group
+ * of radio buttons (and
+ * $multiple_select will be
+ * forced to FALSE) (OPTIONAL;
+ * default is FALSE (select widget))
+ *
+ * @return string html formated selection box or radio buttons
+ *
+ */
+ function createWidget_StrList($multiple_select=FALSE, $radio_buttons=FALSE) {
+//FIXME: Currently, $this->htmlencoded is ignored here -- was removed when changing to template-based output; a fix is available as part of proposed centralized sanitizing patch
+
+ // radio buttons instead of select widget?
+ //
+ if ($radio_buttons) {
+
+ global $br, $nbsp;
+ $result = '';
+ foreach ($this->possible_values as $real_value => $disp_value) {
+ $result .= addRadioBox('new_' . $this->name, ($this->value == $real_value), $real_value, array_merge(array('id' => 'new_' . $this->name . '_' . $real_value), $this->aExtraAttribs)) . $nbsp . create_label($disp_value, 'new_' . $this->name . '_' . $real_value);
+ if ($this->size != SMOPT_SIZE_TINY)
+ $result .= $br;