diff options
Diffstat (limited to 'rt/share/html/Widgets')
-rw-r--r-- | rt/share/html/Widgets/ComboBox | 2 | ||||
-rw-r--r-- | rt/share/html/Widgets/Form/Select | 4 | ||||
-rw-r--r-- | rt/share/html/Widgets/SavedSearch | 7 | ||||
-rw-r--r-- | rt/share/html/Widgets/SelectionBox | 121 | ||||
-rwxr-xr-x | rt/share/html/Widgets/TitleBoxStart | 4 |
5 files changed, 54 insertions, 84 deletions
diff --git a/rt/share/html/Widgets/ComboBox b/rt/share/html/Widgets/ComboBox index 7d852e5a0..9c0ac1b1a 100644 --- a/rt/share/html/Widgets/ComboBox +++ b/rt/share/html/Widgets/ComboBox @@ -52,7 +52,7 @@ my $z_index = 9999; %# reset $z_index. assuming at most 1000 comboboxx in one page % $z_index = 9999 if $z_index < 9000; <nobr> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/combobox.js"></script> +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/static/js/combobox.js"></script> <div id="<% $Name %>_Container" class="combobox <%$Class%>" style="z-index: <%$z_index--%>"> <input name="<% $Name %>" id="<% $Name %>" class="combo-text" value="<% $Default || '' %>" type="text" <% $Size ? "size='$Size'" : '' |n %> autocomplete="off" /> diff --git a/rt/share/html/Widgets/Form/Select b/rt/share/html/Widgets/Form/Select index 4489d49f5..fd7a31ca9 100644 --- a/rt/share/html/Widgets/Form/Select +++ b/rt/share/html/Widgets/Form/Select @@ -80,11 +80,11 @@ $AlternativeLabel => loc('other...'), $Multiple => 0, </%ARGS> -<select name="<% $Name %>"> +<select name="<% $Name %>" <% $Multiple ? 'multiple="multiple"' : '' |n%>> % if ( $Default ) { % my $selected = ''; -% $selected = 'selected="selected"' unless @CurrentValue; +% $selected = 'selected="selected"' unless $CurrentValue[0]; <option value="__empty_value__" <% $selected |n %>><% $DefaultLabel %></option> % } diff --git a/rt/share/html/Widgets/SavedSearch b/rt/share/html/Widgets/SavedSearch index 844e8623c..33f41e283 100644 --- a/rt/share/html/Widgets/SavedSearch +++ b/rt/share/html/Widgets/SavedSearch @@ -61,7 +61,8 @@ my $SearchParams = { map { $_ => $args->{$_} } @{$self->{SearchFields}} }; if ( my ( $container_object, $search_id ) = _parse_saved_search( $args->{'SavedSearchLoad'} || $args->{'SavedChartSearchId'} ) ) { - my $search = $container_object->Attributes->WithId($search_id); + my $search = RT::Attribute->new( $session{'CurrentUser'} ); + $search->Load($search_id); # We have a $search and now; import the others $self->{SearchId} = $args->{'SavedSearchLoad'} || $args->{'SavedChartSearchId'}; @@ -110,7 +111,7 @@ if ( $args->{SavedSearchSave} ) { # rename $search->SetDescription( $args->{SavedSearchDescription} ); $search->SetSubValues(%$SearchParams); - push @actions, loc( '[_1] [_2] updated.', loc($self->{SearchType}), $args->{SavedSearchDescription} ); + push @actions, loc( '[_1] [_2] updated.', loc($self->{SearchType}), $args->{SavedSearchDescription} ); } else { # new saved search @@ -122,7 +123,7 @@ if ( $args->{SavedSearchSave} ) { SearchParams => $SearchParams ); if ($ok) { - $self->{CurrentSearch}{Object} = $saved_search->{Attribute}; + $self->{CurrentSearch}{Object} = $saved_search->{Attribute}; $self->{SearchId} = $args->{SavedChartSearchId} = 'RT::User-' . $session{CurrentUser}->id . '-SavedSearch-' . $saved_search->Id; diff --git a/rt/share/html/Widgets/SelectionBox b/rt/share/html/Widgets/SelectionBox index 4ac178b69..01ca6687f 100644 --- a/rt/share/html/Widgets/SelectionBox +++ b/rt/share/html/Widgets/SelectionBox @@ -49,18 +49,15 @@ %# %# SYNOPSIS %# -%# include javascript: -%# <& /Widgets/SelectionBox:header &> -%# %# <%init>: %# my $sel = $m->comp ('/Widgets/SelectionBox:new', -%# Action => me.html', -%# Name => 'my-selection', -%# Available => \@items, +%# Action => me.html', +%# Name => 'my-selection', +%# Available => \@items, %# # you can do things with @{$sel->{Current}} in the %# # OnSubmit callback -%# OnSubmit => sub { my $sel = shift; }, -%# Selected => \@selected); +%# OnSubmit => sub { my $sel = shift; }, +%# Selected => \@selected); %# %# $m->comp ('/Widgets/SelectionBox:process', %ARGS, self => $sel) %# @@ -71,17 +68,7 @@ %# <& /Widgets/SelectionBox:show, self => $sel &> %# %# if the SelectionBox is created with AutoSave option, OnSubmit will be called -%# on every button clicked in non-js mode. -<%method header> -% unless ($nojs) { -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/class.js"></script> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/list.js"></script> -% } -<%ARGS> -$nojs => 0 -</%ARGS> -</%method> - +%# on every button clicked <%method new> <%init> $ARGS{_item_map} = {map {$_->[0] => $_->[1]} @{$ARGS{Available}}}; @@ -103,56 +90,51 @@ if ($self->{Selected} && !ref($self->{Selected})) { $self->{Selected} = [$self->{Selected}]; } -if ($ARGS{fromjs}) { - $self->{Current} = $self->{Selected}; +my $current = $self->{Current} = $ARGS{$self->{Name}.'-Current'}; +if ($current && !ref ($current)) { + $current = [$current]; } -else { - my $current = $self->{Current} = $ARGS{$self->{Name}.'-Current'}; - if ($current && !ref ($current)) { - $current = [$current]; - } - unless ($self->{ReadOnly}) { - ++$self->{Modified}; - if ($ARGS{add}) { - my $choosed = $ARGS{$self->{Name}.'-Available'}; - for my $add (ref($choosed) ? @$choosed : $choosed) { - next if grep { $_ eq $add } @$current; - push @$current, $add; - } +unless ($self->{ReadOnly}) { + ++$self->{Modified}; + if ($ARGS{add}) { + my $choosed = $ARGS{$self->{Name}.'-Available'}; + for my $add (ref($choosed) ? @$choosed : $choosed) { + next if grep { $_ eq $add } @$current; + push @$current, $add; } + } - if ($ARGS{remove}) { - my $choosed = $ARGS{$self->{Name}.'-Selected'}; - for my $del (ref($choosed) ? @$choosed : $choosed) { - @$current = map { $_ eq $del ? () : $_ } @$current; - } + if ($ARGS{remove}) { + my $choosed = $ARGS{$self->{Name}.'-Selected'}; + for my $del (ref($choosed) ? @$choosed : $choosed) { + @$current = map { $_ eq $del ? () : $_ } @$current; } + } - if ($ARGS{moveup} or $ARGS{movedown}) { - my $offset = $ARGS{moveup} ? 1 : 0; - my $choosed = $ARGS{$self->{Name}.'-Selected'}; - $choosed = [$choosed] unless ref ($choosed); - my $canmove = 0; # not in the cornor - for my $i ($ARGS{moveup} ? 0..$#{$current} : reverse 0..$#{$current}) { - if (grep {$_ eq $current->[$i]} @$choosed) { - if ($canmove) { - splice (@$current, $i-$offset, 2, - @{$current}[$i+1-$offset,$i-$offset]); - } - } - else { - ++$canmove; - } + if ($ARGS{moveup} or $ARGS{movedown}) { + my $offset = $ARGS{moveup} ? 1 : 0; + my $choosed = $ARGS{$self->{Name}.'-Selected'}; + $choosed = [$choosed] unless ref ($choosed); + my $canmove = 0; # not in the cornor + for my $i ($ARGS{moveup} ? 0..$#{$current} : reverse 0..$#{$current}) { + if (grep {$_ eq $current->[$i]} @$choosed) { + if ($canmove) { + splice (@$current, $i-$offset, 2, + @{$current}[$i+1-$offset,$i-$offset]); + } + } + else { + ++$canmove; } } + } - if ($ARGS{clear}) { - $current = []; - } - - $self->{Current} = $current; + if ($ARGS{clear}) { + $current = []; } + + $self->{Current} = $current; } @{$self->{Current}} = grep { exists $self->{_item_map}{$_} } @{$self->{Current}}; @@ -182,14 +164,9 @@ $self => undef </%method> <%method show> -<form method="post" action="<%$self->{Action}%>" name="SelectionBox-<% $name %>" id="SelectionBox-<% $name %>" -% unless ($nojs) { -onsubmit="list_<% $name %>.selectAll();" -% } -> +<form method="post" action="<%$self->{Action}%>" name="SelectionBox-<% $name %>" id="SelectionBox-<% $name %>"> <input type="hidden" class="hidden" name="<% $self->{Name} %>-Submit" value="1" /> <& SelectionBox:current, self => $self &> -<input type="hidden" class="hidden" name="fromjs" value="0" /> <&|/l&>Available</&>: <br /> <select name="<%$name%>-Available" id="<%$name%>-Available" size="<%$size%>" multiple="multiple"> @@ -199,7 +176,7 @@ onsubmit="list_<% $name %>.selectAll();" </select> % unless ($self->{ReadOnly}) { -<input name="add" type="submit" class="button" value=" → " /> +<input aria-label="Add" name="add" type="submit" class="button" value=" → " /> % } <select name="<%$name%>-Selected" id="<%$name%>-Selected" size="<%$size%>" multiple="multiple"> @@ -213,8 +190,8 @@ selected="selected" </select> % unless ($self->{'ReadOnly'}) { % unless ($ARGS{'NoArrows'}) { - <input name="moveup" type="submit" class="button" value=" ↑ " /> - <input name="movedown" type="submit" class="button" value=" ↓ " /> + <input aria-label="Move up" name="moveup" type="submit" class="button" value=" ↑ " /> + <input aria-label="Move down" name="movedown" type="submit" class="button" value=" ↓ " /> % } <input name="remove" type="submit" class="button" value="<&|/l&>Delete</&>" /> % if ($ARGS{'Clear'}) { @@ -234,17 +211,9 @@ selected="selected" % } </form> -% unless ($nojs) { -<script type="text/javascript"> -//<![CDATA[ -var list_<%$name%> = new list(document.getElementById("SelectionBox-<% $name %>"), 0, "list_<%$name%>"); -//]]> -</script> -% } <%ARGS> $self => undef $size => 10 -$nojs => 0 </%ARGS> <%INIT> my $name = $self->{Name}; diff --git a/rt/share/html/Widgets/TitleBoxStart b/rt/share/html/Widgets/TitleBoxStart index 4b6a6f114..249285765 100755 --- a/rt/share/html/Widgets/TitleBoxStart +++ b/rt/share/html/Widgets/TitleBoxStart @@ -54,8 +54,8 @@ $title_href ? qq[<a href="$title_href">] : '' | n %><% $title %><% $title_raw |n %><% $title_href ? "</a>" : '' |n%></span> <span class="right<%($titleright_href || $titleright || $titleright_raw) ? '' : '-empty' %>">\ - <% $titleright_href ? qq[<a href="$titleright_href">] : '' | n %>\ - <% $titleright %><% $titleright_raw |n%><% $titleright_href ? "</a>" : '' |n%>\ + <% $titleright_href ? qq[<a href="$titleright_href">] : '' | n %>\ + <% $titleright %><% $titleright_raw |n%><% $titleright_href ? "</a>" : '' |n%>\ </span> </div> <div class="titlebox-content <% $bodyclass %><% $rolledup ? " hidden" : ""%>" id="<% $tid %>"> |