return $rv;
}
-=head2 ui_checked_columns_row(&columns, &tdtags, checkname, checkvalue, [checked?], [disabled])
+=head2 ui_checked_columns_row(&columns, &tdtags, checkname, checkvalue, [checked?], [disabled], [tags])
Returns HTML for a row in a multi-column table, in which the first column
contains a checkbox. The parameters are :
=item disabled - Set to 1 if the checkbox should be disabled and thus un-clickable.
+=item tags - Extra HTML tags to include in the radio button.
+
=cut
sub ui_checked_columns_row
{
return &theme_ui_checked_columns_row(@_) if (defined(&theme_ui_checked_columns_row));
-my ($cols, $tdtags, $checkname, $checkvalue, $checked, $disabled) = @_;
+my ($cols, $tdtags, $checkname, $checkvalue, $checked, $disabled, $tags) = @_;
my $rv;
$rv .= "<tr $cb class='ui_checked_columns'>\n";
$rv .= "<td class='ui_checked_checkbox' ".$tdtags->[0].">".
- &ui_checkbox($checkname, $checkvalue, undef, $checked, undef, $disabled).
+ &ui_checkbox($checkname, $checkvalue, undef, $checked, $tags, $disabled).
"</td>\n";
my $i;
for($i=0; $i<@$cols; $i++) {
return $rv;
}
-=head2 ui_radio_columns_row(&columns, &tdtags, checkname, checkvalue, [checked], [disabled])
+=head2 ui_radio_columns_row(&columns, &tdtags, checkname, checkvalue, [checked], [disabled], [tags])
Returns HTML for a row in a multi-column table, in which the first
column is a radio button. The parameters are :
=item disabled - Set to 1 if the radio button should be disabled and thus un-clickable.
+=item tags - Extra HTML tags to include in the radio button.
+
=cut
sub ui_radio_columns_row
{
return &theme_ui_radio_columns_row(@_) if (defined(&theme_ui_radio_columns_row));
-my ($cols, $tdtags, $checkname, $checkvalue, $checked, $dis) = @_;
+my ($cols, $tdtags, $checkname, $checkvalue, $checked, $dis, $tags) = @_;
my $rv;
$rv .= "<tr $cb class='ui_radio_columns'>\n";
$rv .= "<td class='ui_radio_radio' ".$tdtags->[0].">".
# Checkbox in non-first column
push(@cols, &ui_checkbox($c->{'name'}, $c->{'value'},
$c->{'label'}, $c->{'checked'},
- undef, $c->{'disabled'}));
+ $c->{'tags'},
+ $c->{'disabled'}));
}
elsif ($c->{'type'} eq 'radio') {
# Radio button in non-first column
push(@cols, &ui_oneradio($c->{'name'}, $c->{'value'},
$c->{'label'}, $c->{'checked'},
- undef, $c->{'disabled'}));
+ $c->{'tags'},
+ $c->{'disabled'}));
}
elsif ($c->{'type'} eq 'group') {
# Header row that spans whole table
elsif ($c0->{'type'} eq 'checkbox') {
$rv .= &ui_checked_columns_row(\@cols, \@rtds, $c0->{'name'},
$c0->{'value'}, $c0->{'checked'},
- $c0->{'disabled'});
+ $c0->{'disabled'},
+ $c0->{'tags'});
}
elsif ($c0->{'type'} eq 'radio') {
$rv .= &ui_radio_columns_row(\@cols, \@rtds, $c0->{'name'},
$c0->{'value'}, $c0->{'checked'},
- $c0->{'disabled'});
+ $c0->{'disabled'},
+ $c0->{'tags'});
}
}
=item disabled - Set to 1 if this text box should be disabled by default.
+=item tags - Additional HTML attributes for the <input> tag.
+
+=item defaultunits - Units mode selected by default
+
=cut
sub ui_bytesbox
{
-my ($name, $bytes, $size, $dis) = @_;
+my ($name, $bytes, $size, $dis, $tags, $defaultunits) = @_;
my $units = 1;
-if ($bytes >= 10*1024*1024*1024*1024) {
+if ($bytes eq '' && $defaultunits) {
+ $units = $defaultunits;
+ }
+elsif ($bytes >= 10*1024*1024*1024*1024) {
$units = 1024*1024*1024*1024;
}
elsif ($bytes >= 10*1024*1024*1024) {
$bytes =~ s/\.00$//;
}
$size = &ui_max_text_width($size || 8);
-return &ui_textbox($name, $bytes, $size, $dis)." ".
+return &ui_textbox($name, $bytes, $size, $dis, undef, $tags)." ".
&ui_select($name."_units", $units,
[ [ 1, "bytes" ],
[ 1024, "kB" ],
}
$rv .= "<tr class='ui_multi_select_row'>";
$rv .= "<td>".&ui_select($name."_opts", [ ], $leftover,
- $size, 0, 0, $dis, $wstyle)."</td>\n";
+ $size, 1, 0, $dis, $wstyle)."</td>\n";
$rv .= "<td>".&ui_button("->", $name."_add", $dis,
"onClick='multi_select_move(\"$name\", form, 1)'")."<br>".
&ui_button("<-", $name."_remove", $dis,
"onClick='multi_select_move(\"$name\", form, 0)'")."</td>\n";
$rv .= "<td>".&ui_select($name."_vals", [ ], $values,
- $size, 0, 0, $dis, $wstyle)."</td>\n";
+ $size, 1, 0, $dis, $wstyle)."</td>\n";
$rv .= "</tr></table>\n";
$rv .= &ui_hidden($name, join("\n", map { $_->[0] } @$values));
return $rv;
var vals_idx = vals.selectedIndex;
if (dir == 1 && opts_idx >= 0) {
// Moving from options to selected list
- var o = opts.options[opts_idx];
- vals.options[vals.options.length] = new Option(o.text, o.value);
- opts.remove(opts_idx);
+ for(var i=0; i<opts.options.length; i++) {
+ var o = opts.options[i];
+ if (o.selected) {
+ vals.options[vals.options.length] =
+ new Option(o.text, o.value);
+ opts.remove(i);
+ i--;
+ }
+ }
}
else if (dir == 0 && vals_idx >= 0) {
// Moving the other way
- var o = vals.options[vals_idx];
- opts.options[opts.options.length] = new Option(o.text, o.value);
- vals.remove(vals_idx);
+ for(var i=0; i<vals.options.length; i++) {
+ var o = vals.options[i];
+ if (o.selected) {
+ opts.options[opts.options.length] =
+ new Option(o.text, o.value);
+ vals.remove(i);
+ i--;
+ }
+ }
}
// Fill in hidden field
var hid = f.elements[name];
}
# Build list of tab titles and names
-my $tabnames = "[".join(",", map { "\"".&html_escape($_->[0])."\"" } @$tabs)."]";
-my $tabtitles = "[".join(",", map { "\"".&html_escape($_->[1])."\"" } @$tabs)."]";
+my $tabnames = "[".join(",", map { "\""."e_escape($_->[0])."\"" } @$tabs)."]";
+my $tabtitles = "[".join(",", map { "\""."e_escape($_->[1])."\"" } @$tabs)."]";
$rv .= "<script>\n";
$rv .= "document.${name}_tabnames = $tabnames;\n";
$rv .= "document.${name}_tabtitles = $tabtitles;\n";
return &theme_js_redirect(@_);
}
$window ||= "window";
+if ($url =~ /^\//) {
+ # If the URL is like /foo , add webprefix
+ $url = $gconfig{'webprefix'}.$url;
+ }
return "<script>${window}.location = '"."e_escape($url)."';</script>\n";
}